Go Down

Topic: Random RGB Values Give Pastel Colors (Read 1 time) previous topic - next topic

rickso234

Have some RGB LEDS in a strip and looking to create some random colors for a background effect. When I calculate three random numbers say from 1 to 50 (so they're not too bright) then set the R, G, and B LEDS to those values I get different colors but they're always pastel and never vivid.

Is there a way to process the random numbers somehow to weight them toward more vivid colors, maybe pick numbers from 1 to 255 then scale them down to reduce brightness?

Would I have better luck to create an array of RGB numbers for colors that I want and just randomly step around the array?

johnwasser

Unless one of the three colors is 0 you will not get vivid colors. Any amount of brightness shared by all three will come out as white mixed with your color.  For example 50R/50G/0B is bright yellow but 50R/50G/30B is pastel yellow.

You could pick three random values and then randomly pick one of the three to set to 0.

0R/50G/30B = Greenish Blue
50R/0G/30B = Reddish Purple
50R/50G/0B = Bright Yellow
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

rickso234

Great idea... and I like the idea of randomly altering random numbers!

fungus


Great idea... and I like the idea of randomly altering random numbers!


You could use HSV color model, not RGB color model. Random 'hue' will always be saturated.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

Grumpy_Mike

Quote
You could pick three random values and then randomly pick one of the three to set to 0.

You can also pick one to be randomly 255 as well.
The other way is to jay use the top two bits of each component.
In truth there are not all that many vivid colours anyway.

Go Up