|
|
Question : Dynamic Color
|
|
|
|
Hi All,
I'm playing with displaying some different colors for different values and I'm looking for a way of generating these colors dynamically.
So for example yellow is below 85, green is between 85 and 89, purple is 90 - 93, white is above 93.
So my question is at 89.5, what shade of green and purple do I display? At what point does the purple cut out and the green just become a dark green?
The end objective is to generate different gradients depending on what's going on, but looking for a concrete way of generating the values of the colors and just not wrapping my head around it as of yet.
Any and all suggestions welcome, this is more a pseudo coding exercise at the moment. I know the questions I'm asking are a bit fuzzy, but I'm looking for different ways to determining said values that make sense.
|
|
|
|
Answer : Dynamic Color
|
|
We need some more variables so I'll get rid of the periods here from line 15 and also the perc * which is easier to do later:
If mixColor1 = "g" Then color1G = maxGreen ElseIf mixColor1 = "p" Then color1R = maxRed color1B = maxBlue ElseIf mixColor1 = "w" Then color1R = maxRed color1G = maxGreen color1B = maxBlue
Do the same for the next section. Then:
color1.G = perc * color1G + (1.0-perc) * color2.G
and so on for color1 and color2.
|
|
|
|