It is currently March 28th, 2024, 7:14 pm

Changing colour on skin

Get help with creating, editing & fixing problems with skins
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Changing colour on skin

Post by CyberTheWorm »

Hi All,

I'm make a thermometer skin so I just started out and everything is working correctly. See skin below

Code: Select all

[Rainmeter]
Update=1000

[Metadata]
Author=CyberTheWorm
Version=1.0.0
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Information=Temp Test

;-------------------- Variables ----------------------
[Variables]
; LocationCode can be obtained at http://wxdata.weather.com/wxdata/search/search?where=YourCityName
LocationCode=CAXX0485
; Don't change this
UnitOfMeasure=m

; Don't change this
DaysFeed=1


; Locale (language) to use in the feed.
; https://msdn.microsoft.com/en-us/goglobal/bb896001.aspx
; Note that Weather.com uses "_" underline instead of "-" dash in the codes.
Locale=en_US

WebSite=https://wxdata.weather.com/wxdata/weather/local/#LocationCode#?cc=*&unit=#UnitOfMeasure#&dayf=#DaysFeed#&locale=#Locale#

MyFontColor=255,0,0,255
;-------------------- Measures ----------------------------
[MeasureValues]
Measure=Plugin
Plugin=WebParser
URL=#WebSite#
RegExp=(?siU)<tmp>(.*)</tmp>
;Update every 15 mins
UpdateRate=900

[MeasureCurrentTemp]
Measure=Plugin
Plugin=WebParser
URL=[MeasureValues]
StringIndex=1

[MeasureTempCalcValue]
Measure=Calc
Formula=(MeasureCurrentTemp * -2)+100
;--------------------- Meters --------------------------------
[MeterBackGround]
Meter=Shape
X=0
Y=0
Shape=Line 40,0,120,0 |StrokeWidth 1 | Stroke Color 255,255,255,255
Shape2=Line 40,20,120,20 |StrokeWidth 1 | Stroke Color 255,255,255,255
Shape3=Line 40,40,120,40 |StrokeWidth 1 | Stroke Color 255,255,255,255
Shape4=Line 40,60,120,60 |StrokeWidth 1 | Stroke Color 255,255,255,255
Shape5=Line 40,80,120,80 |StrokeWidth 1 | Stroke Color 255,255,255,255
Shape6=Line 40,100,120,100 |StrokeWidth 1 | Stroke Color 255,255,255,255
Shape7=Line 40,120,120,120 |StrokeWidth 1 | Stroke Color 255,255,255,255
Shape8=Line 40,140,120,140 |StrokeWidth 1 | Stroke Color 255,255,255,255
Shape9=Line 40,160,120,160 |StrokeWidth 1 | Stroke Color 255,255,255,255
Shape10=Line 40,180,120,180 |StrokeWidth 1 | Stroke Color 255,255,255,255
Shape11=Line 40,200,120,200 |StrokeWidth 1 | Stroke Color 255,255,255,255
AntiAlias=1
DynamicVariables=1

[MeterString40]
Meter=String
X=40
Y=20
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=RightCenter
Text=40

[MeterString104]
Meter=String
X=120
Y=20
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=LeftCenter
Text=104

[MeterString30]
Meter=String
X=40
Y=40
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=RightCenter
Text=30

[MeterString86]
Meter=String
X=120
Y=40
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=LeftCenter
Text=86

[MeterString20]
Meter=String
X=40
Y=60
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=RightCenter
Text=20

[MeterString68]
Meter=String
X=120
Y=60
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=LeftCenter
Text=68

[MeterString10]
Meter=String
X=40
Y=80
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=RightCenter
Text=10

[MeterString50]
Meter=String
X=120
Y=80
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=LeftCenter
Text=50

[MeterString0]
Meter=String
X=40
Y=100
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=RightCenter
Text=0

[MeterString32]
Meter=String
X=120
Y=100
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=LeftCenter
Text=32

[MeterString-10]
Meter=String
X=40
Y=120
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=RightCenter
Text=-10

[MeterString14]
Meter=String
X=120
Y=120
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=LeftCenter
Text=14

[MeterString-20]
Meter=String
X=40
Y=140
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=RightCenter
Text=-20

[MeterString-4]
Meter=String
X=120
Y=140
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=LeftCenter
Text=-4

[MeterString-30]
Meter=String
X=40
Y=160
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=RightCenter
Text=-30

[MeterString-22]
Meter=String
X=120
Y=160
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=LeftCenter
Text=-22

[MeterString-40]
Meter=String
X=40
Y=180
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=RightCenter
Text=-40

[MeterString-40F]
Meter=String
X=120
Y=180
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=LeftCenter
Text=-40

[MeterString-50]
Meter=String
X=40
Y=200
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=RightCenter
Text=-50

[MeterString-58]
Meter=String
X=120
Y=200
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=LeftCenter
Text=-58

[MeterTemp]
Meter=Shape
X=0
Y=0
Shape=Line 80,200,80,[MeasureTempCalcValue] | StrokeWidth 40 | Stroke Color #MyFontColor#
AntiAlias=1
DynamicVariables=1

[MeterTempText]
Meter=String
MeasureName=MeasureCurrentTemp
X=80
Y=200
AntiAlias=1
FontColor=255,255,255,255
FontSize=10
StringAlign=Center
Text=%1°C
When I add the following measure to change the colour of the bar it hangs Rainmeter, I'm doing something really stupid I think.

Code: Select all

[MeasureColour]
Measure=Calc
Formula=MeasureCurrentTemp
IfCondition=(MeasureColour<=0)
IfTrueAction=[!WriteKeyValue Variables MyFontColor 0,0,255,255][!Refresh]
IfFalseAction=[!WriteKeyValue Variables MyFontColor 255,0,0,255][!Refresh]
UpdateRate=60
tt.PNG
You do not have the required permissions to view the files attached to this post.
Last edited by CyberTheWorm on February 21st, 2018, 12:54 am, edited 1 time in total.
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing colour on skin

Post by jsmorley »

CyberTheWorm wrote:Hi All,

<snip>

When I add the following measure to change the colour of the bar it hangs Rainmeter, I'm doing something really stupid I think.

Code: Select all

[MeasureColour]
Measure=Calc
Formula=MeasureCurrentTemp
IfCondition=(MeasureColour<=0)
IfTrueAction=[!WriteKeyValue Variables MyFontColor 0,0,255,255][!Refresh]
IfFalseAction=[!WriteKeyValue Variables MyFontColor 255,0,0,255][!Refresh]
UpdateRate=60
You are refreshing the skin no matter what the value is, which causes it to immediately check again, and refresh the skin no matter what the value is, which is the song that never ends, it just goes on and on my friend... Oh, and as fast as Rainmeter possible can, which is really, really, really, really fast. It will attempt to write to the hard drive and refresh the skin once every 100 nanoseconds or so, which might be a good way to stress test your PC, but no way to go through life son.

Fortunately, Rainmeter will have a nervous breakdown and chew off its own arm trying to escape long before it can actually China Syndrome your hard drive.

Don't overuse !Refresh. Use !SetVariable or !SetOption along with the !WriteKeyValue, !UpdateMeter the meters, !Redraw the skin and skin carry on. !Refresh MUST NEVER be used in an IfCondition. It is a certain journey into the event horizon of a black hole.

I see no reason for !WriteKeyValue in any case. What about this do you need to be "persistent" if the skin is unloaded and reloaded?
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Changing colour on skin

Post by CyberTheWorm »

jsmorley wrote: Don't overuse !Refresh. Use !SetVariable or !SetOption along with the !WriteKeyValue, !UpdateMeter the meters, !Redraw the skin and skin carry on. !Refresh MUST NEVER be used in an IfCondition. It is a certain journey into the event horizon of a black hole.
Thanks, I did the following and it seems to be working

Code: Select all

[MeasureColour]
Measure=Calc
Formula=MeasureCurrentTemp
IfAboveValue=0
IfAboveAction=[!SetVariable  BarColour 255,0,0,255]
IfBelowAction=[!SetVariable  BarColour 0,0,255,255]
DynamicVariables=1
The only source of knowledge is experience. Albert Einstein
Deviant Art Page
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing colour on skin

Post by jsmorley »

CyberTheWorm wrote:Thanks, I did the following and it seems to be working

Code: Select all

[MeasureColour]
Measure=Calc
Formula=MeasureCurrentTemp
IfAboveValue=0
IfAboveAction=[!SetVariable  BarColour 255,0,0,255]
IfBelowAction=[!SetVariable  BarColour 0,0,255,255]
DynamicVariables=1
Yes, might add some update and redraw:

Code: Select all

[MeasureColour]
Measure=Calc
Formula=MeasureCurrentTemp
IfAboveValue=0
IfAboveAction=[!SetVariable  BarColour "255,0,0,255"][!UpdateMeter *][!Redraw]
IfBelowAction=[!SetVariable  BarColour "0,0,255,255"][!UpdateMeter *][!Redraw]
And remove the DynamicVariables=1, which is not needed.

That will make it the most "responsive", while not trying to break any laws of physics.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Changing colour on skin

Post by jsmorley »

I did enjoy crafting my response to your original question though, so thanks for that! ;-)
User avatar
CyberTheWorm
Posts: 860
Joined: August 22nd, 2016, 11:32 pm
Location: Surrey, B.C., Canada

Re: Changing colour on skin

Post by CyberTheWorm »

jsmorley wrote:That will make it the most "responsive", while not trying to break any laws of physics.
I thought I was in the matrix for a while :o
The only source of knowledge is experience. Albert Einstein
Deviant Art Page