It is currently April 19th, 2024, 7:46 pm
Black/White font toggle
-
- Posts: 32
- Joined: June 16th, 2018, 9:27 pm
Black/White font toggle
Hello, I'm currently working on a button that lets me change my font color between black and white. I've set a #MainColour# in the @Variables.inc file and included it in all the skins. So far so good, but how do I make the icon toggle between the two colors? Picture for reference: https://i.imgur.com/UXWCbCS.jpg
-
- Rainmeter Sage
- Posts: 16146
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Black/White font toggle
J0wNs wrote:Hello, I'm currently working on a button that lets me change my font color between black and white. I've set a #MainColour# in the @Variables.inc file and included it in all the skins. So far so good, but how do I make the icon toggle between the two colors? Picture for reference: https://i.imgur.com/UXWCbCS.jpg
Code: Select all
[Variables]
Color=0
[MeasureColor]
Measure=Calc
Formula=#Color#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction=[!SetOption MeterColor FontColor "255,255,255"][!UpdateMeter "MeterColor"][!Redraw]
IfFalseAction=[!SetOption MeterColor FontColor "0,0,0"][!UpdateMeter "MeterColor"][!Redraw]
DynamicVariables=1
[MeterColor]
Meter=String
SolidColor=0,0,0,100
Text=Click to change color
LeftMouseUpAction=[!SetVariable Color "(1-#Color#)"][!UpdateMeasure "MeasureColor"]
DynamicVariables=1
Obviously if you have a MainColour variable set into an included file, you can use it. Just have to replace the explicitly set color into the appropriate !SetBang. Eg instead of [!SetOption MeterColor FontColor "255,255,255"] use [!SetOption MeterColor FontColor "#MainColour#"].
-
- Posts: 32
- Joined: June 16th, 2018, 9:27 pm
Re: Black/White font toggle
Thanks, but now how do I make it change the font color of all the other skins? Is it possible?
-
- Rainmeter Sage
- Posts: 16146
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Black/White font toggle
I'd do the following: would include all String meters of the first skin (will have to do the same with all other skins) which should have to change the color, into a group, adding a Group=MyGroup (obviously you can name it as you'd like) option to all such String meters. Then I'd modify the !SetOption bang as it follows: [!SetOptionGroup MyGroup FontColor "255,255,255" "FirstConfig"][!UpdateMeterGroup "MyGroup" "FirstConfig"][!Redraw "FirstConfig"]. The last parameter is the name of one config which contains one or more String meters belonging to the "MyGroup" group. You should have to add so many this kind of !SetOptionGroup bangs, as many configs do you have, which has one or more such String meters.J0wNs wrote:Thanks, but now how do I make it change the font color of all the other skins? Is it possible?
-
- Posts: 32
- Joined: June 16th, 2018, 9:27 pm
Re: Black/White font toggle
I don't think I understood the config part, could you please be more specific?
-
- Rainmeter Sage
- Posts: 16146
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Black/White font toggle
Let's say you have the following skins:J0wNs wrote:I don't think I understood the config part, could you please be more specific?
- Skins\FirstConfig\Skin1.ini
- Skins\SecondConfig\Skin2.ini
- Skins\ThirdConfig\Skin3.ini
- Skin1.ini has the following String meters: [MeterStringFirst1], [MeterStringFirst2] and [MeterStringFirst3]
- Skin2.ini the following meters: [MeterStringSecond1], [MeterStringSecond2] and [MeterStringSecond3]
- Finally Skin3.ini has the following meters: [MeterStringThird1], [MeterStringThird2] and [MeterStringThird3]
My previously posted [MeasureColor] measure should have to look like:
Code: Select all
[MeasureColor]
Measure=Calc
Formula=#Color#
IfCondition=(#CURRENTSECTION#=0)
IfTrueAction= [!SetOptionGroup MyGroup FontColor "255,255,255" "FirstConfig"][!SetOptionGroup MyGroup FontColor "255,255,255" "SecondConfig"][!SetOptionGroup MyGroup FontColor "255,255,255" "ThirdConfig"][!UpdateMeterGroup "MyGroup" "FirstConfig"][!UpdateMeterGroup "MyGroup" "SecondConfig"][!UpdateMeterGroup "MyGroup" "ThirdConfig"] [!Redraw "FirstConfig"][!Redraw "SecondConfig"]
[!Redraw "ThirdConfig"]
IfFalseAction= [!SetOptionGroup MyGroup FontColor "0,0,0" "FirstConfig"][!SetOptionGroup MyGroup FontColor "0,0,0" "SecondConfig"][!SetOptionGroup MyGroup FontColor "0,0,0" "ThirdConfig"][!UpdateMeterGroup "MyGroup" "FirstConfig"][!UpdateMeterGroup "MyGroup" "SecondConfig"][!UpdateMeterGroup "MyGroup" "ThirdConfig"] [!Redraw "FirstConfig"][!Redraw "SecondConfig"]
[!Redraw "ThirdConfig"]
DynamicVariables=1
Same for the !UpdateMeterGroup and !RedrawGroup bangs.
A few details about the config: https://docs.rainmeter.net/manual/skins/#Config
-
- Posts: 32
- Joined: June 16th, 2018, 9:27 pm
Re: Black/White font toggle
Now that's clear. However, even if I swapped the FirstConfig and so on with the proper names, the "click to change" button doesn't work anymore
-
- Rainmeter Sage
- Posts: 16146
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Black/White font toggle
What the "doesn't work anymore" means? You can't click it or when you click it does nothing?J0wNs wrote:However, even if I swapped the FirstConfig and so on with the proper names, the "click to change" button doesn't work anymore
-
- Posts: 32
- Joined: June 16th, 2018, 9:27 pm
Re: Black/White font toggle
When I click it it does nothing
-
- Rainmeter Sage
- Posts: 16146
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Black/White font toggle
Please post the code of both, the [MeasureColor] measure and the "Click to change" button.J0wNs wrote:When I click it it does nothing