It is, perfectly.Carje wrote: ↑March 22nd, 2019, 8:47 pm Perfect, it worked!
So, to understand the code:
R = Clamp((5.1*[MeasureCPU]),0,255) -> R is 5.1 * MeasureCPU value with a value of min 0 and max 255
G = Clamp((255-(2.55*[MeasureCPU])),0,255) -> G is 2.55 * MeasureCPU value, subtracted from 255, with a value of min 0 and max 255
B = 0
MeasureCPU value being an integer of CPU usage between 0 and 100
Is this right ?
To explain why have I done it this way, you probably know that green is 0,255,0, red is 255,0,0, while orange is 255,127,0. So, from green to orange (from 0% up to 50%), the red component of the color code has to increase from 0 up to 255 and above 50% it has to be kept on 255. Multiplying the CPU usage percent (the value of the [MeasureCPU] measure) with 5.1, I got exactly this variation. Since the product above 50% would increase above 255 (which shouldn't have to go on), I used the Clamp function, to limit the result.
The green component has to decrease from 255 (the green component of the color used for 0%), to 0% (the same green component for the color used on 100%). The result of multiplication of 2.55 with the CPU usage increases from 0 to 255. I substracted this value from 255. Just for safe I also added another Clamp function.
I suppose is clare what have I done for the blue component: I kept it on 0, since it's not involved at all in non of the needed colors.
I'm glad if it does work as you wanted.