It is currently April 18th, 2024, 3:49 pm

Set meter colors from measure

Report bugs with the Rainmeter application and suggest features.
kati42
Posts: 35
Joined: May 4th, 2009, 4:25 am

Set meter colors from measure

Post by kati42 »

This problem could actually be solved *most* helpfully by having measures change variable values. However, the other option is to add a bang command or something to explicitly change a meter's color. I'm thinking of something like:

Code: Select all

[MeasureAC]
Measure=Plugin
Plugin=Plugins\PowerPlugin.dll
PowerState=ACLINE
IfEqualValue=0
IfEqualAction=!RainmeterColorMeter MeterPowerBar #ColorAC#
IfAboveValue=0
IfAboveAction=!RainmeterColorMeter MeterPowerBar #ColorBattery#
But as I said, it'd be even better to have something like

Code: Select all

[MeasureAC]
Measure=Plugin
Plugin=Plugins\PowerPlugin.dll
PowerState=ACLINE
IfEqualValue=0
IfEqualAction=!RainmeterUpdateVariable PowerBarColor #ColorAC#
IfAboveValue=0
IfAboveAction=!RainmeterUpdateVariable PowerBarColor #ColorBattery#
This, by the way, is a case where I'd want the ColorAC and ColorBattery variables to be settings easily changed by the user, but I'd want the PowerBarColor variable hidden from them (to avoid confusion / problems / tech support).

Anyway - I think having different meter colors based on different conditions is very common (battery levels, wireless signal levels, CPU utilization, etc). This would make the configs more efficient for those cases, both in terms of coding efficiency and probably execution.
ryan_the_leach
Posts: 1
Joined: May 11th, 2009, 10:07 am

Re: Set meter colors from measure

Post by ryan_the_leach »

This would be great, i registered just to say i would love to have this, if i did i would become a skin maker just to get this to work on the skins i use, one of them did something similar, where a yellow lightning bolt would appear... has this been added in already?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Set meter colors from measure

Post by jsmorley »

One way you can do it is to change the color of a meter's bar by using a little shell game with "show" and "hide"

[BinAction]
Measure=Calc
Formula=MeasureBar
IfBelowAction=!execute [!RainmeterHideMeter MeterBarRed][!RainmeterShowMeter MeterBarGreen]
IfBelowValue=100
IfAboveAction=!execute [!RainmeterHideMeter MeterBarGreen][!RainmeterShowMeter MeterBarRed]
IfAboveValue=99

Then have two identical meters, one with a green bar and one with a red bar. Just switch which one shows based on some value from the measure. Set the red one with "Hidden=1" and the green one with "HIdden=0" so that that initial state is that the green one shows. Then when the value of the measure hits 100 (in this example, could be any value) the bar will change to red.

The same method could be used to show or hide a lightning bolt or a werewolf next to a full moon as desired! ;-)
kati42
Posts: 35
Joined: May 4th, 2009, 4:25 am

Re: Set meter colors from measure

Post by kati42 »

Yeah - that's what I do now. But it's clunky compared to being able to change a variable with a bang. ;)
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Set meter colors from measure

Post by jsmorley »

I don't disagree. Having the ability to change variable values in "memory" on the fly would open up a world of possibilities. Not just colors, but font's, URLs, images, you name it. This would really add significantly to making Rainmeter a lot of "animated" and "interactive".
sgtevmckay

Re: Set meter colors from measure

Post by sgtevmckay »

Can one set up several Variables under different header names and the have one variable over ride the other with a Value action?
Maybe even going as far as to not make the traditional Variables?

IfAbovevalue=0
Variable1
Stuff here

Ifbelowvalue=2
Variable2
Stuff here

And so on?