Search code examples
algorithmcolorscolor-scheme

Automatic creation of a color scheme


Are there algorithms to create 'nice' color schemes?

Criterias for 'nice' would be:

  • unlimited number of colors, although limited to below 10 in typical use cases

  • pleasing to the eye, so it doesn't look like somebody jumped into some color pots or tried to mimick the color scheme of computer games when there where only 16 fixed colors or less a computer could display.

  • reasonable contrast, i.e. arbitrary combinations of colors from the scheme can get differentiated without a problem. Ideally this would take into account that human perception of color difference isn't mapped 1:1 to frequencies. Obvious contrast will break down with to many colors.

The practical background is that I want to color the diagrams created by Degraph in a nice and useful way.


Solution

  • I usually select a base color and change the hue in 5-6 step (=changing main color) If I need more colors, I'd change saturation (strength or grayish) or luminosity.

    The problem here is that you should avoid two adjacent colors (on your drawing) to be close together in terms of 'distance' of the three values H,S,L.

    This is quite easy to implement and gives acceptable results.

    e.g. (use the windows color editor)
    (S=140, L=160): H=0,40,80,120,160,200
    (S=90 , L=180); H=20,60,100,140, 180

    Please don't use too many colors. Play with fill patterns as well.