How to generate random 'greenish' colors

后端 未结 9 1977
鱼传尺愫
鱼传尺愫 2020-12-28 13:31

Anyone have any suggestions on how to make randomized colors that are all greenish? Right now I\'m generating the colors by this:

color = (randint(100, 200),         


        
9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-28 13:47

    Check out the colorsys module:

    http://docs.python.org/library/colorsys.html

    Use the HSL or HSV color space. Randomize the hue to be close to green, then choose completely random stuff for the saturation and V (brightness).

提交回复
热议问题