有没有办法拆分 colorsys 的 rgb 输出,以便它与 turtle 一起工作

问题描述 投票:0回答:0

我正在使用 color sys 和 turtle 创建一个着色器,使更远的物体看起来更暗。 我没有尝试过任何东西,因为我对 python 的了解还不足以知道该怎么做。

import turtle
import colorsys

t = turtle.Turtle()

def hsv2rgb(h,s,v):
    return tuple(round(i * 255) for i in hsv_to_rgb(h,s,v))

a = hsv2rgb(240, 100 / 100, (120 - (distance / 1.5)) / 100)
t.pencolor(a)

(距离是任意数字)

python math colors turtle-graphics python-turtle
© www.soinside.com 2019 - 2024. All rights reserved.