It is currently October 2nd, 2024, 2:40 am

Changing color of clock skin based on time of day

Get help with creating, editing & fixing problems with skins
User avatar
balala
Rainmeter Sage
Posts: 16616
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing color of clock skin based on time of day

Post by balala »

sumduck wrote: August 3rd, 2021, 7:25 pm No it wasnt a typo. I guess if its better to join them, I'd rather do that. Thanks a lot for your help!
I'm glad, but I think we didn't finish yet. Beside the existing bangs (the !SetVariable ones) add the followings as well, to get updated the meters and redrawn the skin: [!UpdateMeter "MeterDay"][!UpdateMeter "Meter24hClock"][!UpdateMeter "Meter12hClock"][!UpdateMeter "MeterDate"][!Redraw]. With these the measure looks this way:

Code: Select all

[MeasureHour]
Measure=Time
Format=%#H.M
IfCondition=(MeasureHour<=8)
IfTrueAction=[!SetVariable MyColor "255,255,255"][!UpdateMeter "MeterDay"][!UpdateMeter "Meter24hClock"][!UpdateMeter "Meter12hClock"][!UpdateMeter "MeterDate"][!Redraw]
IfCondition2=((MeasureHour>8)&&(MeasureHour<=16))
IfTrueAction2=[!SetVariable MyColor "0,0,0"][!UpdateMeter "MeterDay"][!UpdateMeter "Meter24hClock"][!UpdateMeter "Meter12hClock"][!UpdateMeter "MeterDate"][!Redraw]
IfCondition3=(MeasureHour>16)
IfTrueAction3=[!SetVariable MyColor "255,255,255"][!UpdateMeter "MeterDay"][!UpdateMeter "Meter24hClock"][!UpdateMeter "Meter12hClock"][!UpdateMeter "MeterDate"][!Redraw]
Please check the code and let me know if it works.
User avatar
sumduck
Posts: 9
Joined: August 3rd, 2021, 5:54 pm

Re: Changing color of clock skin based on time of day

Post by sumduck »

Sorry I had to go out for a little bit. I put that in but maybe I put it in the wrong spot or something because it's still not working. Here's my code right now:

Code: Select all

[Rainmeter]
Update=1000
Author=Connect-R
BackgroundMode=2
SolidColor=0,0,0,1
DynamicWindowSize=1
AccurateText=1
MouseScrollUpAction=[!SetVariable Scale "(#Scale#+#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#+#ScrollMouseIncrement#)"][!Refresh] 
MouseScrollDownAction=[!SetVariable Scale "(#Scale#-#ScrollMouseIncrement# < 0.5 ? 0.5 : #Scale#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables Scale "(#Scale#-#ScrollMouseIncrement# < 0.5 ? 0.5 : #Scale#-#ScrollMouseIncrement#)"][!Refresh] 
LeftMouseDoubleClickAction=!ToggleConfig "Mond\Settings" "Settings.ini"

[Variables]
@include=#@#Variables.inc
@include2=#@#Language\Language.inc
Scale=1.16

;-------------------------------------------------------------
;-------------------------------------------------------------

[MeasureTime]
Measure=Time
Format="%#Format#:%M"

[MeasureAmPm]
Measure=Time
Format="%p"

[MeasureDay]
Measure=Time
Format=%A
Substitute=#Date#

[MeasureDate]
Measure=Time
Format=%d  %B,  %Y.
Substitute=#Date#

[MeasureHour]
Measure=Time
Format=%#H.M
IfCondition=(MeasureHour<=8)
IfTrueAction=[!SetVariable MyColor "255,255,255"][!UpdateMeter "MeterDay"][!UpdateMeter "Meter24hClock"][!UpdateMeter "Meter12hClock"][!UpdateMeter "MeterDate"][!Redraw]
IfCondition2=((MeasureHour>8)&&(MeasureHour<=16))
IfTrueAction2=[!SetVariable MyColor "0,0,0"][!UpdateMeter "MeterDay"][!UpdateMeter "Meter24hClock"][!UpdateMeter "Meter12hClock"][!UpdateMeter "MeterDate"][!Redraw]
IfCondition3=(MeasureHour>16)
IfTrueAction3=[!SetVariable MyColor "255,255,255"][!UpdateMeter "MeterDay"][!UpdateMeter "Meter24hClock"][!UpdateMeter "Meter12hClock"][!UpdateMeter "MeterDate"][!Redraw]
;-------------------------------------------------------------
;-------------------------------------------------------------

[Meter24hClock]
Meter=String
MeasureName=MeasureTime
StringAlign=Center
StringCase=Upper
FontFace=Quicksand
FontColor=MyColor
FontSize=(14*#Scale#)
X=(340*#Scale#)
Y=(120*#Scale#)
Text="- %1 -"
AntiAlias=1
Hidden=#Hidden#
DynamicVariables=1

[Meter12hClock]
Meter=String
MeasureName=MeasureTime
MeasureName2=MeasureAmPm
StringAlign=Center
StringCase=Upper
FontFace=Quicksand
FontColor=MyColor
FontSize=(14*#Scale#)
X=(0*#Scale#)r
Y=(0*#Scale#)r
Text="- %1 %2 -"
AntiAlias=1
Hidden=#Hidden2#
DynamicVariables=1

[MeterDay]
Meter=String
MeasureName=MeasureDay
StringAlign=Center
StringCase=Upper
FontFace=Anurati
FontColor=MyColor
FontSize=(40*#Scale#)
X=(340*#Scale#)
Y=(0*#Scale#)
Text="%1"
InlineSetting=CharacterSpacing | (10*#Scale#) | (10*#Scale#)
AntiAlias=1
DynamicVariables=1

[MeterDate]
Meter=String
MeasureName=MeasureDate
StringAlign=Center
StringCase=Upper
FontFace=Quicksand
FontColor=MyColor
FontSize=(14*#Scale#)
X=(340*#Scale#)
Y=(75*#Scale#)
Text="%1"
AntiAlias=1
DynamicVariables=1
User avatar
balala
Rainmeter Sage
Posts: 16616
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing color of clock skin based on time of day

Post by balala »

sumduck wrote: August 3rd, 2021, 8:54 pm I put that in but maybe I put it in the wrong spot or something because it's still not working.
What is wrong is that in the replaced FontColor options of the four String meters ([MeterDay], [Meter24hClock], [Meter12hClock] and [MeterDate]), you didn't use the #MyColor# variable, but only and simply MyColor, which can't be used this way. So replace these options (FontColor=MyColor) in all four meter with FontColor=#MyColor#.
User avatar
sumduck
Posts: 9
Joined: August 3rd, 2021, 5:54 pm

Re: Changing color of clock skin based on time of day

Post by sumduck »

FINAALLY! Thank you so much it works perfectly.
User avatar
balala
Rainmeter Sage
Posts: 16616
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing color of clock skin based on time of day

Post by balala »

sumduck wrote: August 4th, 2021, 6:23 am FINAALLY! Thank you so much it works perfectly.
Glad to help, however I'd definitely do something else as well.
for instance instead of having four almost similar String meters, would create a meter style section, where all common options could be added, then would use this section into all meters. Here is the example: replace the [Meter24hClock], [Meter12hClock], [MeterDay] and [MeterDate] meters with the following [StringStyle] section and the following slightly modified meters:

Code: Select all

[StringStyle]
StringAlign=Center
StringCase=Upper
FontColor=#MyColor#
AntiAlias=1
DynamicVariables=1

[Meter24hClock]
Meter=String
MeterStyle=StringStyle
MeasureName=MeasureTime
FontFace=Quicksand
FontSize=(14*#Scale#)
X=(340*#Scale#)
Y=(120*#Scale#)
Text=- %1 -
Hidden=#Hidden#

[Meter12hClock]
Meter=String
MeterStyle=StringStyle
MeasureName=MeasureTime
MeasureName2=MeasureAmPm
FontFace=Quicksand
FontSize=(14*#Scale#)
X=(0*#Scale#)r
Y=(0*#Scale#)r
Text=- %1 %2 -
Hidden=#Hidden2#

[MeterDay]
Meter=String
MeterStyle=StringStyle
MeasureName=MeasureDay
FontFace=Anurati
FontSize=(40*#Scale#)
X=(340*#Scale#)
Y=(0*#Scale#)
Text=%1
InlineSetting=CharacterSpacing | (10*#Scale#) | (10*#Scale#)

[MeterDate]
Meter=String
MeterStyle=StringStyle
MeasureName=MeasureDate
FontFace=Quicksand
FontSize=(14*#Scale#)
X=(340*#Scale#)
Y=(75*#Scale#)
Text=%1
See that the meters themselves have been reduced a little bit, making maybe the code easier to follow.
Additional note: There is not needed to include any option into quotes. Rainmeter simply ignores them. It's not a problem if you have them, don't cause trouble, but simply are useless. I'm talking about how have you included the Text options for instance into quotes. For example the Text option of the [Meter24hClock] meter was this: Text="- %1 -". the quotes being not-needed, I removed them, getting this: Text=- %1 -, which is perfectly enough. Some details here.
User avatar
sumduck
Posts: 9
Joined: August 3rd, 2021, 5:54 pm

Re: Changing color of clock skin based on time of day

Post by sumduck »

I see. Okay I'll update it. Thanks for all your help!
User avatar
balala
Rainmeter Sage
Posts: 16616
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Changing color of clock skin based on time of day

Post by balala »

sumduck wrote: August 4th, 2021, 6:47 pm I see. Okay I'll update it. Thanks for all your help!
Glad to help.