How to generate random 'greenish' colors

后端 未结 9 2073
鱼传尺愫
鱼传尺愫 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:56

    So in this case you are lucky enough to want variations on a primary color, but for artistic uses like this it is better to specify color wheel coordinates rather than primary color magnitudes.

    You probably want something from the colorsys module like:

    colorsys.hsv_to_rgb(h, s, v)
        Convert the color from HSV coordinates to RGB coordinates.
    

提交回复
热议问题