Just thought I would show one way to do it, that I find pleasing.
SKIN:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[MeasureToggleColor]
Measure=Script
ScriptFile=ToggleColor.lua
UpdateDivider=-1
[MeterToToggle]
Meter=String
FontSize=11
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Hello World
LeftMouseUpAction=[!CommandMeasure MeasureToggleColor "ToggleColor('#CURRENTSECTION#', '255,255,255,255','255,0,0,255')"]
Code: Select all
function ToggleColor(meterName,color1,color2)
myMeter = SKIN:GetMeter(meterName)
currentColor = myMeter:GetOption('FontColor')
if currentColor == color1 then
newColor = color2
else
newColor = color1
end
SKIN:Bang('!SetOption', meterName, 'FontColor', newColor)
SKIN:Bang('!UpdateMeter', '*')
SKIN:Bang('!Redraw')
end
It gets the current value of FontColor from the meter, and tests if it is color1 or color2. It then switches them, and sends a !SetOption bang back to the meter to change it.
Quite simple, and can be used in as many meters in the skin as you need, since it is not specific to any particular meter, or sets of colors. It's all defined in the !CommandMeasure call to the script function.
Nothing says this has to be just FontColor, it would work just as well for any meter option you want to toggle. FontSize, StringStyle, pretty much anything.