Preferably using PHP, I'd like to create X number of colors based on X number of items and using a predefined color range. For example:
ITEM -- VALUE
1 -- 1,234,567,890
2 -- 234,567,890
3 -- 34,567,890
4 -- 4,567,890
5 -- 567,890
Color Range
red = largest value
green = medium value
blue = smallest value
Example
Item 1 gets color red
Item 2 gets whatever color naturally comes between red and green
Item 3 gets color green
Item 4 gets whatever color naturally comes between green and blue
Item 5 gets color blue
Requirements
The code should be able to handle any number of items. 5 items was just an easy example.
Some Thoughts
- Number of items = number of colors
- How to divide a color range into number of items?
- Colors can be represented in decimal format: red=255,000,000 blue=000,000,255
- Can a formula be created, based on the color decimal format, to solve this problem?
I think it's the math portion of the problem that I'm stuck on right now.
Thanks for your help,
Nick