Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Algorithm For Generating Unique Colors

I am looking for an algorithm that will generate a series of colors so that the colors will be as widely distributed as possible (so they won't easily be mixed up).

I have a series of objects that have IDs that count up from 1. I would like to represent each of these with a different, aesthetically pleasing, color that won't get easily confused with its neighbors. The colors should not necessarily be random though. I would like to get the same color each time I input the same ID.

like image 875
Bridger Maxwell Avatar asked Jul 22 '09 21:07

Bridger Maxwell


People also ask

How many unique colors are there in an image?

256*256*256 =16777216 means in total you can have 16777216 possibilities of colors.

How many distinct Colours are there?

It has been determined by people who determine such things that there are somewhere around 18 decillion varieties of colors available for your viewing enjoyment. That's an 18 followed by 33 zeros.


1 Answers

I've checked all the ways to do it, solving more than a few ways. And finally brute force with CIEde2000 and really, your best bet is just a static list. You can't get more than about 30 colors with good distinctness no matter what you do. Factor in color blindness and the lines of confusion, and you're really making something that is a hindrance. Use a lookup table and modify the data points with some other characteristics than just color.

max difference color palette

#000000 #00FF00 #0000FF #FF0000 #01FFFE #FFA6FE #FFDB66 #006401 #010067 #95003A #007DB5 #FF00F6 #FFEEE8 #774D00 #90FB92 #0076FF #D5FF00 #FF937E #6A826C #FF029D #FE8900 #7A4782 #7E2DD2 #85A900 #FF0056 #A42400 #00AE7E #683D3B #BDC6FF #263400 #BDD393 #00B917 #9E008E #001544 #C28C9F #FF74A3 #01D0FF #004754 #E56FFE #788231 #0E4CA1 #91D0CB #BE9970 #968AE8 #BB8800 #43002C #DEFF74 #00FFC6 #FFE502 #620E00 #008F9C #98FF52 #7544B1 #B500FF #00FF78 #FF6E41 #005F39 #6B6882 #5FAD4E #A75740 #A5FFD2 #FFB167 #009BFF #E85EBE 
like image 93
Tatarize Avatar answered Sep 23 '22 14:09

Tatarize