Is there any well-known method for generating random, good looking and yet distinctive colors? I've worked with this before, and managed to generate colors at random. However, either they had a great chance of turning out "ugly" (yellow-ish brown, green-ish gray and others), or they turned out to be almost the same.
Now, as for measuring if two colors are almost the same, it's quite easy to just take the color channels and compare the differences between them.
I suspect that I will always need to generate between 1 and 15 colors.
Edit It's for some graphing stuff I am making in JavaScript. That may help you understand why I am in need of this.
I assume you're randomizing in the RGB color space; if you use a different color space, e.g. HSB, it is easier to determine whether two colors are similar, and you can limit the range of each axis to exclude 'ugly' colors.
For example, you may want to create the first color using:
And then a contrasting color using:
The possibilities are endless, but the key idea is that HSB is a more 'natural' color space to randomize over, because you control the perceived properties of a color (hue, saturation, brightness), not the technical properties (intensities of three channels).
I don't know about selecting single colors, since "ugly" and "good-looking" are very subjective terms.
Color schemes, or sets of colors that match, on the other hand, have some theory behind them, and it's very possible to select random colors that go together well.
Check out this website: Color Scheme Designer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With