Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1836

Help: Rainmeter Skins • [Resolved] Bar that changes color based on variable.

$
0
0
I'm so confused with how to use conditional in Rainmeter.

Note: There is bar for each CPU thread. If there is a more performant way to do this please let me know too.
The full skin without my attempt on making the color changes is here: https://gist.github.com/pegasusearl/df99fe8364a5e598f9e0bb8e1ee5f2ca

First try: This gave the bar a weird color. It's a color that I never declare or wrote anywhere in the script. Which is CYAN.

Code:

[Variables]MyAccentColorOpaque=131,192,239MyDarkAccentColorOpaque=200,60,77TheirAccentColor=#MyAccentColorOpaque#,255TheirDarkAccentColor=#MyDarkAccentColorOpaque#,255[CsCpuThrottle]Measure=CalcFormula=1[tCpu1]Meter=BARMeasureName=sCpu1X=#MySectionSpacing#RY=#MyMarginTop#W=#MyBarWidth#H=#MyHeight#BarColor=([CsCpuThrottle] == 0 ? #TheirAccentColor# : #TheirDarkAccentColor#)DynamicVariables=1SolidColor=#MyBarBackground#BarOrientation=Vertical

From this moment forward I will not write the variable but they are the same.

Then I tried this:

Code:

[CsCpuThrottle]Measure=CalcFormula=0[tCpu1]Meter=BARMeasureName=sCpu1X=#MySectionSpacing#RY=#MyMarginTop#W=#MyBarWidth#H=#MyHeight#BarColor=([CsCpuThrottle] == 0 ? 0,0,0,0 : 1,1,1,1)DynamicVariables=1SolidColor=#MyBarBackground#BarOrientation=Vertical
Same result. Weird CYAN color. Not white or black.

Being confused with Rainmeter syntax is not a new thing for me. In other case I simply create `Measure=Calc` to workaround it.
So I will try that this time.

Code:

[CsCpuThrottle]Measure=CalcFormula=0[CsCpuColor]Measure=CalcFormula=(CsCpuThrottle = 0 ? 0,0,0 : 1,1,1)[tCpu1]Meter=BARMeasureName=sCpu1X=#MySectionSpacing#RY=#MyMarginTop#W=#MyBarWidth#H=#MyHeight#BarColor=[CsCpuColor]DynamicVariables=1SolidColor=#MyBarBackground#BarOrientation=Vertical
It worked, cool. No it didn't I misunderstand earlier. It will always be white no matter the CsCpuThrottle value.

But I don't want to manually change the value in the script whenever I wanted different accent color.
So I tried with variable:

Code:

[CsCpuThrottle]Measure=CalcFormula=0[CsCpuColor]Measure=CalcFormula=(CsCpuThrottle = 0 ? TheirAccentColor : TheirDarkAccentColor)[tCpu1]Meter=BARMeasureName=sCpu1X=#MySectionSpacing#RY=#MyMarginTop#W=#MyBarWidth#H=#MyHeight#BarColor=[CsCpuColor]DynamicVariables=1SolidColor=#MyBarBackground#BarOrientation=Vertical
Well this didn't work. It's still white. How about if I added ##

Code:

Formula=(CsCpuThrottle = 0 ? #TheirAccentColor# : #TheirDarkAccentColor#)
Nope didn't work either.
Now I'm at a loss and require assistance.

-= UPDATE =-

Alright this one worked. But it's one calc for every bar, and there are 6 of them.

Code:

[CsSourceThrottle]Measure=CalcFormula=1[CsCpuThrottle]Measure=CalcFormula=1IfCondition=CsSourceThrottle = 0IfTrueAction=[!SetOption tCpu1 BarColor #TheirAccentColor#]IfFalseAction=[!SetOption tCpu1 BarColor #TheirAccentThrottled#][tCpu1]Meter=BARMeasureName=sCpu1X=#MySectionSpacing#RY=#MyMarginTop#W=#MyBarWidth#H=#MyHeight#BarColor=#TheirAccentColorSolidColor=#MyBarBackground#BarOrientation=Vertical
I tried this:

Code:

[!SetOption tCpu1 BarColor #TheirAccentColor#][!SetOption tCpu2 BarColor #TheirAccentColor#]
But it doesn't work for tCpu2, and is ugly.

Statistics: Posted by pegasusearl — Yesterday, 5:31 pm



Viewing all articles
Browse latest Browse all 1836

Trending Articles