It is currently April 26th, 2024, 1:08 am
Changing the color of text dynamically for clock
-
- Posts: 35
- Joined: July 3rd, 2012, 6:16 pm
Changing the color of text dynamically for clock
So basically if I wanted the text displaying the time change it's color every second, how should I go about it?
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Changing the color of text dynamically for clock
There are tons of ways, here is one:
Code: Select all
[Rainmeter]
Update=1000
[MeasureRed]
Measure=Calc
Formula=Random
UpdateRandom=1
LowBound=0
HighBound=255
[MeasureGreen]
Measure=Calc
Formula=Random
UpdateRandom=1
LowBound=0
HighBound=255
[MeasureBlue]
Measure=Calc
Formula=Random
UpdateRandom=1
LowBound=0
HighBound=255
[MeasureHourMinute]
Measure=Time
Format=%#I:%M
[MeasureSecond]
Measure=Time
Format=%S
[MeterHourMinute]
Meter=String
MeasureName=MeasureHourMinute
FontFace=Arial
FontSize=70
FontColor=255,255,255,255
StringStyle=Bold
Antialias=1
Text=%1:
[MeterSecond]
Meter=String
MeasureName=MeasureSecond
X=-27R
FontFace=Arial
FontSize=70
FontColor=[MeasureRed],[MeasureGreen],[MeasureBlue],255
StringStyle=Bold
Antialias=1
DynamicVariables=1
-
- Posts: 35
- Joined: July 3rd, 2012, 6:16 pm
Re: Changing the color of text dynamically for clock
This works perfectly. Thanks!
-
- Posts: 35
- Joined: July 3rd, 2012, 6:16 pm
Re: Changing the color of text dynamically for clock
Follow-up ..
Does `UpdateRandom` take variables/meters? I tried but it doesn't work.
Does `UpdateRandom` take variables/meters? I tried but it doesn't work.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Changing the color of text dynamically for clock
UpdateRandom is just a true (1) or false (0) option for a Calc measure using the Random function. It simply tells the measure to get a "new" random number on each update of the skin.LeftSide wrote:Follow-up ..
Does `UpdateRandom` take variables/meters? I tried but it doesn't work.
Otherwise the default behavior is to get a single random number that would not change unless the skin is refreshed.
-
- Posts: 35
- Joined: July 3rd, 2012, 6:16 pm
Re: Changing the color of text dynamically for clock
Oh jeez damnit I meant `LowBound` and `HighBound`. Excuse my brain fart.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Changing the color of text dynamically for clock
You can use a variable defined in the [Variables] section as #VarName#. You can also use the number value of a measure with [MeasureName:], as long as you also put DynamicVariables=1 on the measure where you are setting LowBound / HighBound.LeftSide wrote:Oh jeez damnit I meant `LowBound` and `HighBound`. Excuse my brain fart.
Note, I used [MeasureName:] since you want the number value of the measure and not a string value. If the measure you are using only returns a number (or the number and string values are the same numerical value) then you can just use [MeasureName].
-
- Posts: 35
- Joined: July 3rd, 2012, 6:16 pm
Re: Changing the color of text dynamically for clock
Then I must be doing it wrong...
Here I have put `LowBound=[Color_Time_mS]` but as you see `[MeasureGreen]` is disobeying (its value `114` is less than lowerbound 128.77725). I think it's taking any value from 0-255 regardless of what I put in LowerBound except for a number.
Here I have put `LowBound=[Color_Time_mS]` but as you see `[MeasureGreen]` is disobeying (its value `114` is less than lowerbound 128.77725). I think it's taking any value from 0-255 regardless of what I put in LowerBound except for a number.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Changing the color of text dynamically for clock
Without DynamicVariables=1 on [MeasureGreen] (for instance), it will only use the very first value that the calc measure returns, and is never updated.
-
- Posts: 35
- Joined: July 3rd, 2012, 6:16 pm
Re: Changing the color of text dynamically for clock
Thanks so much! I did read the part about setting DynamicVariables but kept on thinking it's only required in [Meter]s. Another brain fart x_x. Thanks again