It is currently March 28th, 2024, 8:31 am

Weather temperature Dynamic Color

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

Re: Weather temperature Dynamic Color

Post by balala »

xenium wrote:yes,when the weather data is updated and the temperature corresponds to another temperature range
Now it's past midnight here and I'm going to sleep, but I promise tomorrow I'll help you with this, too.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Weather temperature Dynamic Color

Post by xenium »

balala wrote:Now it's past midnight here and I'm going to sleep, but I promise tomorrow I'll help you with this, too.
thank you very much and .... easy sleep :welcome:
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather temperature Dynamic Color

Post by balala »

Here is my solution. The only thing you should have to do is to add the following two options to the [MeasureSlide] measure:

Code: Select all

[MeasureSlide]
...
IfCondition=(#W#>=100)
IfTrueAction=[!CommandMeasure "MeasureSlide" "Stop 1"][!SetVariable W "0"][!SetVariable Color "[#TempColor[&MeasureColor]]"]#U#
That's all. Although this will work (I hope), I'm not sure at all you'll see the temperature value filling up, because usually the temperature doesn't change too much on two consecutive update cycles, and the colors belonging to close temperature values are close enough to be hard to see the filling up. But the method works.
Just two more remarks:
  • The quotation marks aren't needed around no options, eg around the RegExp. Eg I recommend to replace the RegExp option of the [MeasureName] measure (RegExp=[color=#FF0000]"[/color](?siU)<h1>(.*)</h1>[color=#FF0000].*"[/color]) with the following simpler one: RegExp=(?siU)<h1>(.*)</h1>.
  • As I said, the AppVersion option (used in the [Rainmeter] section) is deprecated and should have to be removed, while the Author was moved to [Metadata]. Because of this, these two section should have to look like, for example, in the following way:

    Code: Select all

    [Rainmeter]
    Update=1000
    
    [Metadata]
    Author=xxenium
    instead of the original [Rainmeter] section:

    Code: Select all

    [Rainmeter]
    Author=xxenium
    AppVersion=1.0
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Weather temperature Dynamic Color

Post by xenium »

balala wrote:Here is my solution. The only thing you should have to do is to add the following two options to the [MeasureSlide] measure:

Code: Select all

[MeasureSlide]
...
IfCondition=(#W#>=100)
IfTrueAction=[!CommandMeasure "MeasureSlide" "Stop 1"][!SetVariable W "0"][!SetVariable Color "[#TempColor[&MeasureColor]]"]#U#
That's all. Although this will work (I hope), I'm not sure at all you'll see the temperature value filling up, because usually the temperature doesn't change too much on two consecutive update cycles, and the colors belonging to close temperature values are close enough to be hard to see the filling up. But the method works.
Just two more remarks:
  • The quotation marks aren't needed around no options, eg around the RegExp. Eg I recommend to replace the RegExp option of the [MeasureName] measure (RegExp=[color=#FF0000]"[/color](?siU)<h1>(.*)</h1>[color=#FF0000].*"[/color]) with the following simpler one: RegExp=(?siU)<h1>(.*)</h1>.
  • As I said, the AppVersion option (used in the [Rainmeter] section) is deprecated and should have to be removed, while the Author was moved to [Metadata]. Because of this, these two section should have to look like, for example, in the following way:

    Code: Select all

    [Rainmeter]
    Update=1000
    
    [Metadata]
    Author=xxenium
    instead of the original [Rainmeter] section:

    Code: Select all

    [Rainmeter]
    Author=xxenium
    AppVersion=1.0
It really works!
Thank you very much
We changed the values from [MeasureSlide] ActionList1, from 20 to 200 to reduce fill speed, and for a good visual effect :D , and so we could see the change in color when switching to a new temperature range.
The visual effect is no longer the same as before, when the color change was over the base white color (now the color changes over the color that was before) but it's ok
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather temperature Dynamic Color

Post by balala »

xenium wrote:We changed the values from [MeasureSlide] ActionList1, from 20 to 200 to reduce fill speed, and for a good visual effect :D , and so we could see the change in color when switching to a new temperature range.
Obviously you can play with the settings, even if i forgot to explain what those constants are in the ActionTimer plugin measure. But it seems you've figured out by yourself, so it's ok...
xenium wrote:The visual effect is no longer the same as before, when the color change was over the base white color (now the color changes over the color that was before) but it's ok
This is exactly what I said you in my last post, but there is nothing which could be done with this. Maybe eventually just using some very different colors.

I'm glad if it's working as you wanted.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Weather temperature Dynamic Color

Post by xenium »

I have a small problem .
I use the formula below, which, depending on the interval, displays the values in a certain color.
But when there is no value on the website, a dash is displayed.
It always takes the color of the first interval.
I would like the dash to always have the white color (I do not want to use "subsitute" to stop being displayed)
How can I do that?

Code: Select all

 [Variables]
ValueColor1=0,228,0
ValueColor2=255,255,0
ValueColor3=255,126,0
ValueColor4=255,0,0
ValueColor5=143,63,151
ValueColor6=126,0,35


[MeasureColorValue]
Measure=Calc
Formula=(((MeasureValue >= 0) && (MeasureValue <= 50)) ? 1 : (((MeasureValue >= 51) && (MeasureValue <= 100)) ? 2 : (((MeasureValue >= 101) && (MeasureValue <= 150)) ? 3 : (((MeasureValue >= 151) && (MeasureValue <= 200)) ? 4 : (((MeasureValue >= 201) && (MeasureValue <= 300)) ? 5 : 6)))))
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather temperature Dynamic Color

Post by balala »

xenium wrote:I have a small problem .
I use the formula below, which, depending on the interval, displays the values in a certain color.
But when there is no value on the website, a dash is displayed.
It always takes the color of the first interval.
I would like the dash to always have the white color (I do not want to use "subsitute" to stop being displayed)
How can I do that?
Please post the current code you have, because the last was posted many days ago and probably in the meantime you've rewrote a few things.
User avatar
xenium
Posts: 841
Joined: January 4th, 2018, 9:52 pm

Re: Weather temperature Dynamic Color

Post by xenium »

I managed to find a solution in the meantime.
I added to the String Meter the options:
InlineSetting = Color 255 255 255
InlinePattern = -
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Weather temperature Dynamic Color

Post by jsmorley »

xenium wrote:I managed to find a solution in the meantime.
I added to the String Meter the options:
InlineSetting = Color 255 255 255
InlinePattern = -
This would actually be:

InlineSetting = Color | 255,255,255
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Weather temperature Dynamic Color

Post by balala »

xenium wrote:I managed to find a solution in the meantime.
I added to the String Meter the options:
InlineSetting = Color 255 255 255
InlinePattern = -
Yes, but this (taking in account jsmorley's modification) sets the text to white only if the measure returns the dash in the very first moment, when the skin is refreshed. If in that moment the skin returns a value, then later it turns to the dash, skin doesn't set the color to white. If your code is the last posted code, then the solution I think would be to first add the white color to the [Variables] section: TempColor0=255,255,255. Now add the following options to the [MeasureTemp] measure (besides the exiting options):

Code: Select all

[MeasureTemp]
...
IfMatch=#
IfMatchAction=[!SetVariable Dash "1"]
IfNotMatchAction=[!SetVariable Dash "0"]
If the measure returns the dash, the value of the Dash variable is set to 1, otherwise to 0.
Finally you should have to modify the Formula option of the [MeasureColor] measure and should have to add a DynamicVariables=1 option to the same measure:

Code: Select all

[MeasureColor]
Measure=Calc
Formula=(( #Dash# = 1 ) ? 0 : ( 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 ))))))))))))))))))))
DynamicVariables=1
This modification takes into account the value of the Dash variable, set up by the previously added IfMatchAction / IfNotMatchAction options. If the value of this variable is 1, it means that the [MeasureTemp] measure returned the dash and in this case the [MeasureColor] measure returns 0. Appropriately the FontColor option of the [MeterTemp] meter sets the color of this meter to white (set up by the previously added TempColor0 variable).
Post Reply