我刚刚在朋友的建议下在python中选择了图像处理,以生成随机颜色的图案.我发现这个在线脚本可以在RGB光谱中生成各种不同的颜色.
def random_color():
levels = range(32,256,32)
return tuple(random.choice(levels) for _ in range(3))
Run Code Online (Sandbox Code Playgroud)
我很有兴趣将此脚本附加到仅生成三种随机颜色中的一种.优选红色,绿色和蓝色.