# Given a number, how to find that many colours that are well-distinguishable?

I'm interested in getting an method for obtaining `n` well-distinguishable colours, where `n` is just a given number. The purpose is for it to be implemented in an algorithmic way.

I have read other questions on this topic (this, this, this and this), but none of them provides an self-contained way how to generate the colours. (They, in general, say: "Go to this website and put `n` there as input.")

As well, I know that I can equally distribute the hues of the colours, but then:

1. Good balancing between number of different hues and number of different saturations and lightnesses is necessary (and I don't know how to make it well).

2. The same distance in hue doesn't mean the same distance for a human:

In the example, certainly the left one is less recognizable than the right one, yet the colours are only some RGB permutations.

• 1: find maximum number of unique colors determined by the system you are using to represent them. 2: determine the minimum difference between 2 colors that a "healthy human" can distinguish. 3: divide the maximum number of colors by that distance. << that (lets call this x) is the largest acceptable input from the user. 4: RNG a starting color. 5: divide x by n from user (to get y). 6: add y to start color n times. 7: show resulting colors. Feb 28, 2013 at 17:09
• Once I know how to generate the colours (and you can show me the way with drawings in a colour space or whatever), I shall be able to make it into a real algorithm. The problem lies in making distinguishable colours, not in making a computer program.
– yo'
Mar 1, 2013 at 15:47
• Reopened because of the edit. I cleaned the comments, you are more than welcome to continue the conversation in the chat. Mar 1, 2013 at 23:32
• There was an excellent answer to this question posted on the gamedev.SE site by Sam Hocevar recently. Mar 3, 2013 at 15:18
• @IlmariKaronen That answer (basically, evenly spaced points on a hue wheel) is a good start but if differentiability and large numbers of colours are your main concerns, you'll reach a point where it's better to add a row higher and lower in lightness and/or lower in saturation than adding more spaces on the hue wheel. Lots of good comments too. Mar 4, 2013 at 13:28