It is currently March 28th, 2024, 10:22 am

How to put this code that can switch skin color according to day and night time into another clock?

Get help with creating, editing & fixing problems with skins
Post Reply
User avatar
Pyuahowaito
Posts: 50
Joined: January 3rd, 2022, 2:44 pm

How to put this code that can switch skin color according to day and night time into another clock?

Post by Pyuahowaito »

I tried many times without any effect
Last edited by Pyuahowaito on March 23rd, 2022, 8:11 am, edited 4 times in total.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to put this code that can switch skin color according to day and night time into another clock?

Post by balala »

Pyuahowaito wrote: January 12th, 2022, 9:09 pm I tried many times without any effect (another clock is in the attachment)
Add a DynamicVariables=1 option to the [MeterTime] meter, because it uses the dynamically set TextColor variable.
User avatar
Pyuahowaito
Posts: 50
Joined: January 3rd, 2022, 2:44 pm

Re: How to put this code that can switch skin color according to day and night time into another clock?

Post by Pyuahowaito »

You may have misunderstood me, I want to apply this code to the clock in the attachment, and let it change the corresponding skin color according to the time of day and night. I don’t know how to do it. I don’t see the word [MeterTime] in the clock of the attachment.
Last edited by Pyuahowaito on March 23rd, 2022, 8:14 am, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to put this code that can switch skin color according to day and night time into another clock?

Post by balala »

Pyuahowaito wrote: January 12th, 2022, 10:53 pm You may have misunderstood me, I want to apply this code to the clock in the attachment, and let it change the corresponding skin color according to the time of day and night. I don’t know how to do it. I don’t see the word [MeterTime] in the clock of the attachment.
You've replaced in meantime the posted code. Then I didn't download the attached skin, just worked with the code. And that one had a meter called [MeterTime]. But doesn't matter.
To do what you want to do, right click the skin, click Edit skin. The code of your skin opens in the default text editor. Add the following measure to the code:

Code: Select all

[MeasureTime]
Measure=Time
Format=%#H
IfCondition=((MeasureTime>=6)&&(MeasureTime<18))
IfTrueAction=[!SetVariable Linecolor "255,255,255,255"][!SetVariable MLinecolor "255,255,255,255"][!SetVariable Hourcolor "255,255,255,255"][!SetVariable Mincolor "255,255,255,255"][!SetVariable Seccolor "255,255,255,255"]
IfFalseAction=[!SetVariable Linecolor "65,65,65,65"][!SetVariable MLinecolor "65,65,65,65"][!SetVariable Hourcolor "65,65,65,65"][!SetVariable Mincolor "65,65,65,65"][!SetVariable Seccolor "65,65,65,65"]
Note here that I shortened a little bit the code of your example, replacing the initial four IfCondition / IfTrueAction options with a single IfCondition and the corresponding IfTrueAction / IfFalseAction. Didn't worth to have all four conditions, because the first two were the same and the last two were again identical.
Please try out the code and let me know if it match your needs.
User avatar
Pyuahowaito
Posts: 50
Joined: January 3rd, 2022, 2:44 pm

Re: How to put this code that can switch skin color according to day and night time into another clock?

Post by Pyuahowaito »

:) It is running stably, and it is worthy of being a professional. It turned out that I only needed to make a little modification on the original basis, but I tossed it for a long time. Thank you for your guidance!
Last edited by Pyuahowaito on March 23rd, 2022, 8:12 am, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: How to put this code that can switch skin color according to day and night time into another clock?

Post by balala »

Pyuahowaito wrote: January 13th, 2022, 6:46 pm :) It is running stably, and it is worthy of being a professional. It turned out that I only needed to make a little modification on the original basis, but I tossed it for a long time. Thank you for your guidance! I also beautified the code a little, it is more beautiful, thank you and the author of this clock, I can feel the charm of the code more and more now
Glad if you like it. :thumbup:
If you want, you can experiment, changing the colors set through the !SetOption bangs of the IfTrueAction and IFalseAction options, finding shades which are better match your needs.
Post Reply