There are many methods to change a meters color and there have been several discussions on which is the best method. All of these discussions have skipped over one of the easier ways. Using a Calc measure and a Substitute one can have 31 color options.
It is best to use negative numbers for your values in the formula since they do not occur in color codes. Since you can have up to 30 nested conditional statement, it is possible to have 31 color codes including the last "else" statement.
[mtBattery]
Meter=String
MeasureName=msBattery
Text="There is %1% remaining."
FontColor=[msTint]
DynamicVariables=1
Note: It is important to leave the value given by the measure as is and not remove the decimal with a substitute. For some reason, removing the ".0" disables the alpha value.
Last edited by smurfier on October 9th, 2011, 5:16 am, edited 3 times in total.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
I tries using this and was able to get it to work with a line graph but could not figure out how to get it to work with a histogram.
The skin I am trying to modify is the HUD CPU1 meter.
Where am I going wrong, I am a newb so bare with me.
Here is what I have.
You forgot about dynamic variables in one of your measures. Also, as with the bar meter, we may not be able to use dynamic variables with a line or histogram meter. This may require some trial and error, but I applaud you for seeing that you can set the color value to a variable using another measure.
[MeasureCPU1]
Measure=Plugin
Plugin=Plugins\PerfMon.dll
PerfMonObject="Processor"
PerfMonInstance=0
PerfMonCounter="% Processor Time"
PerfMonDifference=1
InvertMeasure=1
[msTint]
Measure=Calc
Formula=MeasureCPU1>80 ? -1 :(MeasureCPU1>30 ? -2 : -3)
;^removed a redundancy
Substitute="-1":"255,0,0,75","-2":"0,255,0,75","-3":"0,0,255,75"
[msTint2]
Measure=Calc
Formula=MeasureCPU1>80 ? -1 :(MeasureCPU1>30 ? -2 : -3)
;^removed the same redundancy
Substitute="-1":"255,0,0,37","-2":"0,255,0,37","-3":"0,0,255,37"
[msVarSet]
Measure=Calc
Formula=MeasureCPU1<>(-1)
IfEqualValue=1
IfEqualAction=!RainmeterSetVariable Color [msTint]
DynamicVariables=1
;^you need to use dynamic variables
[CPU1Graph1]
Meter=Line
MeasureName=MeasureCPU1
X=0
Y=4
H=43
W=180
LineCount=1
LineColor=[msTint]
DynamicVariables=1
AntiAlias=1
[CPU1Graph2]
Meter=HISTOGRAM
MeasureName=MeasureCPU1
X=r
;You don't reed a zero before the r. a number is only necessary if you want to add or subtract from the coordinates of the previous meter.
Y=r
H=42
W=180
PrimaryColor=[msTint2]
DynamicVariables=1
AntiAlias=1
[l.str]
Meter=STRING
X=5
Y=43r
StringStyle=NORMAL
StringAlign=LEFT
FontColor=#fontColor.Text#
FontSize=#FontHeight#
FontFace=#FontName#
AntiAlias=1
Text="CPU 1"
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .