I need a way in PHP/HTML to generate a list from 1 to 100 of colors (hex codes). Zero is red, and 100 is green, and each in-between is a shade that smoothly flows between the two. (for example, red to orange to yellow to green).
So say I can throw a number at it, like the number 50, and it returns a hexadecimal code from the list (50 would be yellow).
Is the only way to manually assign each color in an array? Or is there some easier method?
This request is quite odd – I’ve searched around, but I can’t find anything like it.
Give this a try:
Here are the output values from 0-100 going by 10’s: