[gameprogrammer] Re: mapping numbers to colors

  • From: Jake The Snake Briggs <jacob_briggs@xxxxxxxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Fri, 03 Dec 2004 11:06:17 +1300

Binary partition of the colour space. Assign your colors a number, say 0 
through 100. 1 group would yeild the colour at position 0. 3 groups 
would be 25,50 and 75. 4 would be 0,25,50,100, 5 would be 
0,25,50,75,100. Or you could do it with percentage's. 1 group would be 
1/1 with would be the colour referenced by 100. 3 groups would be 1/3, 
the colours would be 33,66 and 100. 5 groups would be 1/5, 20,40,60,80,100.

I am sure there is a better way, maybe working directly with the r,g,b 
values, but i am sure you get the idea of what i am talking about.

If each r,g,b  value can be between 0 and 255, you could just partition 
each of those spaces. like 3 groups would yeild the colours 
(85,85,85),(127,127,127) and (212,212,212).
If this makes no sence, just ignore my brain dump....

Alan Wolfe wrote:

>Hey guys,
>wierd question, possibly straight out of the old school days...
>I'm making some line graphs and i have X number of groups of data.
>X could be 1 or it could be 20, it varies.
>What im trying to do is come up with a good way to automaticly set colors to 
>these groups of data.
>ie if there were 2 groups, 1 line could be red and the 2nd line could be blue.
>if there were 4 groups, i could use red, blue, yellow, green for the lines etc.
>Does anyone know a way to algorithmicly come up with X number of colors, that 
>are as far apart visualy as possible?  Cause if theres 5 groups of data and 
>they are all shades of blue, thats not very good.
>Thanks a bunch for any help :P
>To unsubscribe go to http://gameprogrammer.com/mailinglist.html

To unsubscribe go to http://gameprogrammer.com/mailinglist.html

Other related posts: