Page 1 of 1

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

Posted: January 12th, 2022, 9:09 pm
by Pyuahowaito
I tried many times without any effect

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

Posted: January 12th, 2022, 9:14 pm
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.

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

Posted: January 12th, 2022, 10:53 pm
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.

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

Posted: January 13th, 2022, 9:32 am
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.

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

Posted: January 13th, 2022, 6:46 pm
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!

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

Posted: January 13th, 2022, 7:12 pm
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.