I'd like to do the following using Python:
I have a list of several 'hex code color' strings gradated from green to red.
colorGradient = ['#00a500', '#1ea500', '#3ca500', '#5ab400', '#78b400', '#96c300',
'#b4d200', '#d2d200', '#f0e100', '#fff000', '#ffd200', '#ffb400',
'#ff9600', '#ff7800', '#ff5a00', '#f04b00', '#ff3c00', '#f02d00',
'#e11e00', '#d20f00', '#b40000']
Now I have a sequence of integer values. Like this for example..
integer_values = [1, 8, 5, 3, 6, 9]
I'd like to map each value in this sequence to one of the strings in my 'colorGradient' list. The higher the value is, the more red it should be, by contrast: the lower it is, the more green it should be.
Does anyone of you know how to realize this? Is there already a function in the Python standard library which can do that?