How can I get a list of visually different colors?

I need to assign colors to distinguish between different elements. A simple case: order strings of different colors according to the client.

I do not want the user to select a color for each client, I want to do this at runtime.

If there is one client, I will use "red", if there are two "red" and "white", ...

Of course, I can create my own function GimmeRandomColour(i: index) , which uses the i and RGB functions to create nice random colors (but in this case, creating nice colors can be tricky). Or I can say that if i is 0, give me clRed, ... (so making many colors can be a problem).

How can I get a β€œnice list of colors” with acceptable levels of contrast?

+7
source share
2 answers

There is no built-in function in Delphi. See this question about ways to create nice color schemes.

Algorithm for randomly creating an aesthetically pleasing color palette

+7
source

A common approach is to use the values ​​$ 00, $ 33, $ 66, $ 99, $ CC and $ FF ( Random(6) * $33 ) for each RGB color component.

This will result in 216 different colors that are safe to use.

See wikipedia examples.

+2
source

All Articles