HACKER Q&A
📣 shivekkhurana

Is there an algorithm to generate coherent color palettes?


Designers come up with a collection of colors that are aesthetically pleasing.

Colors on electronic screens are just numbers. So by first principles, designers are in fact picking some numbers from an infinite set.

This selection process is certainly not random. It's common knowledge that blue works well with red on flags.

My question is: can a computer come up with a color palette (ie hex codes) that will work well together?

Is there any literature around this topic?

PS: I'm working on a side project that needs to generate color palettes and I have no clue about it.

Thanks


  👤 muzani Accepted Answer ✓
There's the standard color theory.

You look at a color wheel. Colors on the opposite side of the wheel look good. It's just opposite (complementary), but also tertiary, and so on.

You can also cut out a block from a color wheel. There's some nice examples here: https://forums.tigsource.com/index.php?topic=25396.0

Hex code might seem tough, better to look at it from HSL (Hue, Saturation, Lightness) and focus on only Hue.


👤 thedevindevops
I'm a fan of https://paletton.com/ but someone has tried to apply AI to the problem: http://colormind.io/ though beauty as ever remains in the eye of the beholder...

👤 tlb
Although there are general principles, there's no accurate theory for what looks good. But I think you could train a ML model on data, such as from https://www.colourlovers.com/palettes.

👤 cborenstein
I like https://coolors.co/ for color palette generation. Not sure what their algorithm is.