I am trying to change the percentage value colors of CPU and RAM from the default SYSTEM skin, based on their value, with a gradient
(ie: CPU - from green to orange to red - 0%-50%-90% / RAM - 0)
I searched on the forum and google also but I only found how to change only one color, and failed to make it worked. Some of the codes were too old and don't work anymore and others I simply didn't managed to make them work.
Thanks in advance!
It is currently April 28th, 2024, 12:17 pm
Change Color (Gradient) based on value
-
- Posts: 6
- Joined: March 22nd, 2019, 4:23 pm
-
- Rainmeter Sage
- Posts: 16183
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Change Color (Gradient) based on value
Let's take it step by step. First are you talking about the System skin of illustro package?
-
- Posts: 6
- Joined: March 22nd, 2019, 4:23 pm
-
- Rainmeter Sage
- Posts: 16183
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Change Color (Gradient) based on value
Ok. What do you mean by
and what by
?
-
- Posts: 6
- Joined: March 22nd, 2019, 4:23 pm
Re: Change Color (Gradient) based on value
The text itself (9%,13%,67%,etc)
As I said in the topic : (ie: CPU - from green to orange to red - 0%-50%-90% / RAM - 0) - 9% 18% 24% 33% 41% 52% 63% 70% 79% 84% 90%
As the number get's higher the color turns more red
As the number get's lower the color turns more green
With orange being the middle color
As I said in the topic : (ie: CPU - from green to orange to red - 0%-50%-90% / RAM - 0) - 9% 18% 24% 33% 41% 52% 63% 70% 79% 84% 90%
As the number get's higher the color turns more red
As the number get's lower the color turns more green
With orange being the middle color
-
- Rainmeter Sage
- Posts: 16183
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Change Color (Gradient) based on value
Still not very clear to me, but let's see. Do you want the color of the number showing the percentage to change continuously, accordingly to the CPU usage? So the string always should have to have one, continuously changing color.Carje wrote: ↑March 22nd, 2019, 7:03 pm The text itself (9%,13%,67%,etc)
As I said in the topic : (ie: CPU - from green to orange to red - 0%-50%-90% / RAM - 0) - 9% 18% 24% 33% 41% 52% 63% 70% 79% 84% 90%
As the number get's higher the color turns more red
As the number get's lower the color turns more green
With orange being the middle color
Have I understood this correctly?
-
- Posts: 6
- Joined: March 22nd, 2019, 4:23 pm
Re: Change Color (Gradient) based on value
Basically yes. I don't know if there is anything that can change colors in a gradient automatically or I need to make myself "if's" for every other percent to make it more real. But that's the point, updating the color at the same time with CPU usagebalala wrote: ↑March 22nd, 2019, 7:09 pm Still not very clear to me, but let's see. Do you want the color of the number showing the percentage to change continuously, accordingly to the CPU usage? So the string always should have to have one, continuously changing color.
Have I understood this correctly?
-
- Rainmeter Sage
- Posts: 16183
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Change Color (Gradient) based on value
Ok. Let me a half of hour to look deeper into how to do this. I'll come back a bit later with an answer.
-
- Rainmeter Sage
- Posts: 16183
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Change Color (Gradient) based on value
Try to add the following FontColor option to the [meterValueCPU] meter: FontColor=(Clamp((5.1*[MeasureCPU]),0,255)),(Clamp((255-(2.55*[MeasureCPU])),0,255)),0. Along with this FontColor, you have to add as well a DynamicVariables=1 option to the same [meterValueCPU] meter. Don't forget nor this.
-
- Posts: 6
- Joined: March 22nd, 2019, 4:23 pm
Re: Change Color (Gradient) based on value
Perfect, it worked!balala wrote: ↑March 22nd, 2019, 8:04 pm Try to add the following FontColor option to the [meterValueCPU] meter: FontColor=(Clamp((5.1*[MeasureCPU]),0,255)),(Clamp((255-(2.55*[MeasureCPU])),0,255)),0. Along with this FontColor, you have to add as well a DynamicVariables=1 option to the same [meterValueCPU] meter. Don't forget nor this.
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 ?