It is currently October 1st, 2022, 8:03 am

Weather temperature Dynamic Color

Get help with creating, editing & fixing problems with skins
User avatar
xenium
Posts: 702
Joined: January 4th, 2018, 9:52 pm

Re: Weather temperature Dynamic Color

Post by xenium »

jsmorley wrote:I think it will work if you simply use:

Code: Select all

[MeterSymbol]
Meter=Image
MeasureName=MeasureSymbol
Path=#@#Img[MeasureImg]
X=0
Y=0
DynamicVariables=1
I think you are overestimating needing nested variables to get the result.

I see no need for the [Variables]:

Code: Select all

Img1=#@#Img1
Img2=#@#Img2
Img3=#@#Img3
at all to be honest.

But if you really want to do it the hard(er) way, you could keep the [Variables] and do:

Code: Select all

[MeterSymbol]
Meter=Image
MeasureName=MeasureSymbol
Path=[#Img[&MeasureImg]]
X=0
Y=0
DynamicVariables=1
Just that in this particular case, I'm not sure I see any advantage to using [Variables] and nesting them with the [MeasureName].
we have removed the variables and it works without them :17good
Thank you very much !
:welcome: :welcome:
User avatar
xenium
Posts: 702
Joined: January 4th, 2018, 9:52 pm

Re: Weather temperature Dynamic Color

Post by xenium »

Hi,
I would like to know if it is possible that when the temperature is displayed, it (the font) starts to color from bottom to top (like bar meter) and then stop
thank you

Code: Select all

[Rainmeter]
Author=xxenium
AppVersion=1.0


[Variables]
UpdateRateSeconds=1000
FontFace=Subpear
URL=https://www.foreca.com/Spain/Madrid?tenday
URL1=https://www.foreca.com/Spain/Madrid


TempColor1=58,0,176 
TempColor2=0,0,143
TempColor3=1,1,190
TempColor4=0,0,238 
TempColor5=0,30,255
TempColor6=1,78,255
TempColor7=0,127,255
TempColor8=0,175,255
TempColor9=0,223,255 
TempColor10=15,255,239
TempColor11=63,255,191
TempColor12=111,255,143
TempColor13=159,255,95
TempColor14=207,255,47
TempColor15=255,255,0
TempColor16=255,207,0
TempColor17=255,159,0
TempColor18=255,111,0
TempColor19=255,14,0
TempColor20=174,1,1



===========================================
               Measure
===========================================

[MeasureName]
Measure=WebParser
Url=#URL#
RegExp="(?siU)<h1>(.*)</h1>.*"
UpdateRate=#UpdateRateSeconds#
Substitute="&deg;":""
StringIndex=1


[MeasureTemp]
Measure=WebParser
Url=#URL1#
RegExp="(?siU)<span class=".* txt-xxlarge"><strong>(.*)</strong>.*"
UpdateRate=#UpdateRateSeconds#
StringIndex=1


[MeasureColor]
Measure=Calc
Formula=MeasureTemp < -45 ? 1 : (((MeasureTemp >= -45) && (MeasureTemp < -40)) ? 2 : (((MeasureTemp >= -40) && (MeasureTemp < -35)) ? 3 : (((MeasureTemp >= -35) && (MeasureTemp < -30)) ? 4 : (((MeasureTemp >= -30) && (MeasureTemp < -25)) ? 5 : (((MeasureTemp >= -25) && (MeasureTemp < -20)) ? 6 : (((MeasureTemp >= -20) && (MeasureTemp < -15)) ? 7 : (((MeasureTemp >= -15) && (MeasureTemp < -10)) ? 8 : (((MeasureTemp >= -10) && (MeasureTemp < -5)) ? 9 : (((MeasureTemp >= -5) && (MeasureTemp < 0)) ? 10 : (((MeasureTemp >= 0) && (MeasureTemp < 5)) ? 11 : (((MeasureTemp >= 5) && (MeasureTemp < 10)) ? 12 : (((MeasureTemp >= 10) && (MeasureTemp < 15)) ? 13 : (((MeasureTemp >= 15) && (MeasureTemp < 20)) ? 14 : (((MeasureTemp >= 20) && (MeasureTemp < 25)) ? 15 : (((MeasureTemp >= 25) && (MeasureTemp < 30)) ? 16 : (((MeasureTemp >= 30) && (MeasureTemp < 35)) ? 17 : (((MeasureTemp >= 35) && (MeasureTemp < 40)) ? 18 : (((MeasureTemp >= 40) && (MeasureTemp < 45)) ? 19 : 20))))))))))))))))))




===========================================
                 Meter
===========================================



[MeterName]
Meter=String
MeasureName=MeasureName
X=285
Y=25
W=290
H=50
FontColor=250,250,250,250
StringStyle=bold
StringEffect=SHADOW
FontFace=Subpear
StringAlign=Left
FontEffectColor=0,0,0,80
AntiAlias=1
ClipString=1
FontSize=20



[MeterTemp]
Meter=String
MeasureName=MeasureTemp
X=70
Y=25
W=200
H=80
FontColor=[#TempColor[&MeasureColor]]
StringStyle=bold
StringEffect=SHADOW
FontFace=Subpear
StringAlign=Left
FontEffectColor=0,0,0,80
AntiAlias=1
ClipString=1
FontSize=35
Postfix=" °C"
DynamicVariables=1 
User avatar
balala
Rainmeter Sage
Posts: 14568
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather temperature Dynamic Color

Post by balala »

xenium wrote:I would like to know if it is possible that when the temperature is displayed, it (the font) starts to color from bottom to top (like bar meter) and then stop
Actually it is, based on FreeRaider's idea.

Thanks FreeRaider for that great idea!!!

First you need an ActionTimer plugin measure. Add it as you see below:

Code: Select all

[MeasureSlide]
Measure=Plugin
Plugin=ActionTimer
ActionList1=Repeat Up,20,20
Up=[!SetVariable W "(Clamp((#W#+5),0,100))"]#U#
DynamicVariables=1
This measure uses two variables, which have to be added to the [Variables] section, beside the existing variables:

Code: Select all

[Variables]
...
W=0
U=[!UpdateMeasure "MeasureSlide"][!UpdateMeter "MeterTemp"][!UpdateMeter "Uptime"][!Redraw]
Color=255,240,0
The last variable (Color) is the color code which you'd like to use to color the temperature value.
You also have to add the following option to the [MeterTemp] meter:

Code: Select all

[MeterTemp]
...
InlineSetting=GradientColor | 90 | #Color# ; 0.0 | #Color# ; (#W#/100) | [#TempColor[&MeasureColor]] ; (#W#/100) | [#TempColor[&MeasureColor]] ; 1.0
(Again, just add this option, without modifying the existing ones).
This last option colors the temperature value from its base up to a point defined by the W variable. Because the value of this variable increases from 0 to 100 (once the [MeasureTemp] WebParser measure gets the value - see below the option required to do this), the temperature value is colored progresively.
The last needed thing is to start the [MeasureSlide] measure to run, once the [MeasureTemp] measure gets the value of the temperature. For this you have to add the following option to the [MeasureTemp] measure:

Code: Select all

[MeasureTemp]
...
FinishAction=[!Delay "1000"][!CommandMeasure "MeasureSlide" "Execute 1"]
The !Delay bang above is used to postpone the coloring with one second - you can renounce to it, if you don't want it.

I just want to mention one more thing: both options used in the [Rainmeter] section are deprecated. AppVersion isn't needed any more and Author has been moved to the [Metadata] section. You also should have to move it (although leaving them there isn't a problem).
User avatar
xenium
Posts: 702
Joined: January 4th, 2018, 9:52 pm

Re: Weather temperature Dynamic Color

Post by xenium »

Thank you for your reply
Exactly what I wanted, but ...
initially, the temperature color respects the temperature range from [measurecolor]
Now over the color, the yellow color is displayed.
I want the color corresponding to the temperature range to climb
User avatar
balala
Rainmeter Sage
Posts: 14568
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather temperature Dynamic Color

Post by balala »

xenium wrote:Now over the color, the yellow color is displayed.
I want the color corresponding to the temperature range to climb
And what color should it have before?
User avatar
xenium
Posts: 702
Joined: January 4th, 2018, 9:52 pm

Re: Weather temperature Dynamic Color

Post by xenium »

balala wrote:And what color should it have before?
each temperature range displays the corresponding TempColor color (ex: under -45 degrees TempColor1 = 58.0,176 ,.....)
User avatar
balala
Rainmeter Sage
Posts: 14568
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather temperature Dynamic Color

Post by balala »

xenium wrote:each temperature range displays the corresponding TempColor color (ex: under -45 degrees TempColor1 = 58.0,176 ,.....)
My question was related to the color of the string before the WebParser measure gets the temperature.
User avatar
xenium
Posts: 702
Joined: January 4th, 2018, 9:52 pm

Re: Weather temperature Dynamic Color

Post by xenium »

balala wrote:My question was related to the color of the string before the WebParser measure gets the temperature.
White colour
User avatar
balala
Rainmeter Sage
Posts: 14568
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather temperature Dynamic Color

Post by balala »

xenium wrote:White colour
Finally this isn't too much important. Replace the InLineSetting option of the [MeterTemp] meter with the following one: InlineSetting=GradientColor | 90 | [#TempColor[&MeasureColor]] ; 0.0 | [#TempColor[&MeasureColor]] ; (#W#/100) | #Color# ; (#W#/100) | #Color# ; 1.0. The initial color of the string is set by the Color variable. If you rewrite it to white (Color=255,255,255), in the [Variables] section, it'll be ok.
But there is one more question: with these modifications, the color of the temperature value will follow the appropriate colors set through the TempColorXX variables, but won't be filled up when the temperature is changing. This is happening only once, just first time the WebParser measure gets the temperature. Would you like to fill it up with the new color, every time the temperature is changing?
User avatar
xenium
Posts: 702
Joined: January 4th, 2018, 9:52 pm

Re: Weather temperature Dynamic Color

Post by xenium »

balala wrote:Finally this isn't too much important. Replace the InLineSetting option of the [MeterTemp] meter with the following one: InlineSetting=GradientColor | 90 | [#TempColor[&MeasureColor]] ; 0.0 | [#TempColor[&MeasureColor]] ; (#W#/100) | #Color# ; (#W#/100) | #Color# ; 1.0. The initial color of the string is set by the Color variable. If you rewrite it to white (Color=255,255,255), in the [Variables] section, it'll be ok.
But there is one more question: with these modifications, the color of the temperature value will follow the appropriate colors set through the TempColorXX variables, but won't be filled up when the temperature is changing. This is happening only once, just first time the WebParser measure gets the temperature.
now it's okay
Would you like to fill it up with the new color, every time the temperature is changing?
yes,when the weather data is updated and the temperature corresponds to another temperature range