How to generate random 'greenish' colors

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

    The simplest way to do this is to make sure that the red and blue components are the same, like this: (Forgive my Python)

    rb = randint(100, 200)
    color = (rb, randint(120, 255), rb)
    

提交回复
热议问题