It is currently October 17th, 2021, 3:19 pm

Color not working

Help with creating, editing & fixing problems with skins
Ray
Posts: 1
Joined: October 14th, 2021, 11:56 am

Color not working

Post by Ray »

Hello there, there is an issue with my rainmeter skin. The color doesn't change when i use "IfAboveValue"

le code:

Code: Select all

; Lines starting ; (semicolons) are commented out.
; That is, they do not affect the code and are here for demonstration purposes only.
; ----------------------------------

; NOTE! If you want to add more disks, take a look at 'Disks 2.ini'.

[Rainmeter]
; This section contains general settings that can be used to change how Rainmeter behaves.
Update=1000
Background=#@#Background.png
; #@# is equal to Rainmeter\Skins\illustro\@Resources
BackgroundMode=3
BackgroundMargins=0,34,0,14

[Metadata]
; Contains basic information of the skin.
Name=Disk
Author=poiru
Information=Displays disk usage.
License=Creative Commons BY-NC-SA 3.0
Version=1.0.0

[Variables]
; Variables declared here can be used later on between two # characters (e.g. #MyVariable#).
fontName=Trebuchet MS
textSize=8
colorBar=140,185,186,255
colorText=255,255,255,205
disk1=C:

GPUTEMPColor=255,255,255,205
CPUTEMPColor=255,255,255,205
BATTERYColor=255,255,255,205

; ----------------------------------
; MEASURES return some kind of value
; ----------------------------------
[MeasureBatteryPercent]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Percent

[MeasureBatteryStatus]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Status
Substitute="0":"N/A","1":"Opladen","2":"KRITIEK","3":"Lege Battery","4":"Normaal"
IfAboveValue=14
IfAboveAction=!RainmeterSetVariable BATTERYColor 255,255,255,205
IfBelowValue=15
IfBelowAction=!RainmeterSetVariable BATTERYColor 255,0,0,255

[MeasureFanSpeed]
Measure=Plugin
Plugin=SpeedFanPlugin
SpeedFanType=Fan
SpeedFanNumber=1

[MeasureGPUTemp]
Measure=Plugin
Plugin=SpeedFanPlugin
SpeedFanType=Temperature
SpeedFanNumber=0
SpeedFanScale=C
IfAboveValue=39
IfAboveAction=!RainmeterSetVariable GPUTEMPColor 255,0,0,255
IfBelowValue=40
IfBelowAction=!RainmeterSetVariable GPUTEMPColor 255,255,255,205

[MeasureCPUTemp]
Measure=Plugin
Plugin=SpeedFanPlugin
SpeedFanType=Temperature
SpeedFanNumber=1
SpeedFanScale=C
IfAboveValue=29
IfAboveAction=!RainmeterSetVariable CPUTEMPColor 255,0,0,255
IfBelowValue=30
IfBelowAction=!RainmeterSetVariable CPUTEMPColor 255,255,255,205

[measureBinItems]
; This measure returns the amount of items in the Recycle Bin.
Measure=Plugin
Plugin=RecycleManager.dll
RecycleType=Count
UpdateDivider=3
; UpdateDivider sets the rate at which the value of the measure is updated. It is
; calculated as follows: UpdateDivider x Update. In this case, Update is set to
; 1000 milliseconds (in the [Rainmeter] section). 1000 x 3 = 3000 ms or 3 seconds.

[MeasureFolder]
Measure=Plugin
Plugin=FolderInfo
Folder=C:\Users\rbdev\Desktop\Schoolwerk
InfoType=FolderSize
IncludeHiddenFiles=1
IncludeSubFolders=1
IncludeSystemFiles=1
RegExpFilter=.*
UpdateDivider=120

[measureBinSize]
; Returns the total size of the Recycle Bin in bytes.
Measure=Plugin
Plugin=RecycleManager.dll
RecycleType=Size
UpdateDivider=3

[measureTotalDisk1]
; This measure returns the total disk space
Measure=FreeDiskSpace
Drive=#disk1#
Total=1
UpdateDivider=120

[measureUsedDisk1]
; Returns inverted value of free disk space (i.e. used disk space)
Measure=FreeDiskSpace
Drive=#disk1#
InvertMeasure=1
UpdateDivider=120


[measureIP]
; This measure returns your IPv4 address. WebParser measures are relatively complicated. If you're a beginner with
; Rainmeter, take a look at some of the other illustro skins before modifying this one.
; For more information, go here: https://docs.rainmeter.net/tips/ipaddress
Measure=Plugin
Plugin=WebParser
URL=https://checkip.amazonaws.com/
UpdateRate=14400
RegExp=(?siU)^(.*)$
StringIndex=1
Substitute="":"Loading.."
; Substitute works as follows: "A":"B" where A is a string to substitute and B is a string
; to substitute with. In this case, it substutes "" (i.e. empty) to N/A


[meterSeperator]
Meter=Image
MeterStyle=styleSeperator
X=10
Y=55
W=190
H=1

[meterSeperator2]
Meter=Image
MeterStyle=styleSeperator
X=10
Y=95
W=190
H=1

[meterSeperator3]
Meter=Image
MeterStyle=styleSeperator
X=10
Y=155
W=190
H=1
; ----------------------------------
; STYLES are used to "centralize" options
; ----------------------------------

[styleSeperator]
SolidColor=80,100,100,255

[styleTitle]
StringAlign=Center
StringCase=Upper
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,50
FontColor=#colorText#
FontFace=#fontName#
FontSize=10
AntiAlias=1
ClipString=1

[styleLeftText]
StringAlign=Left
; Meters using styleLeftText will be left-aligned.
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleRightText]
StringAlign=Right
StringCase=None
StringStyle=Bold
StringEffect=Shadow
FontEffectColor=0,0,0,20
FontColor=#colorText#
FontFace=#fontName#
FontSize=#textSize#
AntiAlias=1
ClipString=1

[styleBar]
BarColor=#colorBar#
BarOrientation=HORIZONTAL
SolidColor=255,255,255,15

; ----------------------------------
; METERS display images, text, bars, etc.
; ----------------------------------

[meterTitle]
Meter=String
MeterStyle=styleTitle
; Using MeterStyle=styleTitle will basically "copy" the
; contents of the [styleTitle] section here during runtime.
X=100
Y=12
W=190
H=18
Text=Andere Informatie
; Even though the text is set to Disk, Rainmeter will display
; it as DISK, because styleTitle contains StringCase=Upper.






[meterBLabel]
Meter=String
MeterStyle=styleLeftText
X=10
Y=160
W=190
H=14
Text=Batterij : 


[meterBValue]
Meter=String
MeterStyle=styleRightText
MeasureName=MeasureBatteryPercent
MeasureName2=MeasureBatteryStatus
X=200
Y=0r
; r stands for relative. In this case, the Y postition of meterValueCPU is 0 pixels
; below the Y value of the previous meter (i.e it's the same as in meterLabelCPU).
W=190
H=14
Text=%1% (%2)
; %1 stands for the value of MeasureName (measureIP in this case).
FontColor=#BATTERYColor#


;----------

[meterfanLabel]
Meter=String
MeterStyle=styleLeftText
X=10
Y=140
W=190
H=14
Text=Koelsysteem : 


[meterfanValue]
Meter=String
MeterStyle=styleRightText
MeasureName=MeasureFanSpeed
X=200
Y=0r
; r stands for relative. In this case, the Y postition of meterValueCPU is 0 pixels
; below the Y value of the previous meter (i.e it's the same as in meterLabelCPU).
W=190
H=14
Text=%1 RPM

[meterGPULabel]
Meter=String
MeterStyle=styleLeftText
X=10
Y=100
W=190
H=14
Text=GPU Temp : 


[meterGPUValue]
Meter=String
MeterStyle=styleRightText
MeasureName=MeasureGPUTemp
X=200
Y=0r
; r stands for relative. In this case, the Y postition of meterValueCPU is 0 pixels
; below the Y value of the previous meter (i.e it's the same as in meterLabelCPU).
W=190
H=14
Text=%1°C
; %1 stands for the value of MeasureName (measureIP in this case).
FontColor=#GPUTEMPColor#

[meterCPULabel]
Meter=String
MeterStyle=styleLeftText
X=10
Y=120
W=190
H=14
Text=CPU Temp : 


[meterCPUValue]
Meter=String
MeterStyle=styleRightText
MeasureName=MeasureCPUTemp
X=200
Y=0r
; r stands for relative. In this case, the Y postition of meterValueCPU is 0 pixels
; below the Y value of the previous meter (i.e it's the same as in meterLabelCPU).
W=190
H=14
Text=%1°C
; %1 stands for the value of MeasureName (measureIP in this case).
FontColor=#CPUTEMPColor#

; ------------------------
[meterIPLabel]
Meter=String
MeterStyle=styleLeftText
X=10
Y=40
W=190
H=14
Text=IPv4 Adress : 


[meterIPValue]
Meter=String
MeterStyle=styleRightText
MeasureName=measureIP
X=200
Y=0r
; r stands for relative. In this case, the Y postition of meterValueCPU is 0 pixels
; below the Y value of the previous meter (i.e it's the same as in meterLabelCPU).
W=190
H=14
Text=%1
; %1 stands for the value of MeasureName (measureIP in this case).


[meterBinItems]
Meter=String
MeterStyle=styleLeftText
MeasureName=measureBinItems
X=10
Y=60
W=190
H=14
Text=Prullenbak : 
; %1 stands for the value of MeasureName (measureBinItems in this case).
LeftMouseUpAction=[!CommandMeasure measureBinItems "OpenBin"]
RightMouseUpAction=[!CommandMeasure measureBinItems "EmptyBin"]
ToolTipText=Linkermuis = Openen | Rechtermuis = Legen

[meterBinSize]
Meter=String
MeterStyle=styleRightText
MeasureName=measureBinItems
MeasureName2=measureBinSize
X=200
Y=0r
; r stands for relative. In this case, the Y postition of meterValueCPU is 0 pixels
; below the Y value of the previous meter (i.e it's the same as in meterLabelCPU).
W=190
H=14
Text=%1 Items
; Because measureBinSize returns the size in bytes, we must use AutoScale=1 to
; automatically scale the value into a more readable figure.

[meterLabelDisk1]
Meter=String
MeterStyle=styleLeftText
X=10
Y=80
W=190
H=14
Text=Gebruikte Opslag : 

[meterValueDisk1]
Meter=String
MeterStyle=styleRightText
MeasureName=measureUsedDisk1
MeasureName2=measureTotalDisk1
X=200
Y=0r
; r stands for relative. In this case, the Y postition of meterValueCPU is 0 pixels
; below the Y value of the previous meter (i.e it's the same as in meterLabelCPU).
W=190
H=14
Text=%1%
; %1 stands for the value of MeasureName (measureUsedDisk1 in this case).
; %2 stands for the value of MeasureName2.
NumOfDecimals=1
; Because disk measures return the free/used space in bytes, we must use AutoScale=1 to
; automatically scale the value into a more readable figure.
LeftMouseUpAction=["#disk1#\"]
Percentual=1
ToolTipText=Linkermuis = Openen (Deze PC)
; Open #disk1# on click
User avatar
David8192
Posts: 50
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: Color not working

Post by David8192 »

First off, !RainmeterSetvariable is not a thing. It is only !Setvariable.
Correct that and see what happens. More info after I test your code.
For some Reason, the square root of X2 does not involve X

the DA GALLERY 8-)
User avatar
David8192
Posts: 50
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: Color not working

Post by David8192 »

Replace your bangs with these

Code: Select all

IfAboveValue=39
IfAboveAction=[!SetVariable GPUTEMPColor 255,0,0,255][!UpdateMeter "meterGPUValue"][!Redraw]
IfBelowValue=40
IfBelowAction=[!SetVariable GPUTEMPColor 255,255,255,205][!UpdateMeter "meterGPUValue"][!Redraw]

Code: Select all

IfAboveValue=29
IfAboveAction=[!SetVariable CPUTEMPColor 255,0,0,255][!UpdateMeter "meterCPUValue"][!Redraw]
IfBelowValue=30
IfBelowAction=[!SetVariable CPUTEMPColor 255,255,255,205][!UpdateMeter "meterCPUValue"][!Redraw]
Then, under [meterGPUValue] and [meterCPUValue] add DynamicVariables=1.
It should work fine now. Let me know how it goes.
For some Reason, the square root of X2 does not involve X

the DA GALLERY 8-)
User avatar
balala
Rainmeter Sage
Posts: 13319
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Color not working

Post by balala »

David8192 wrote: October 14th, 2021, 1:04 pm First off, !RainmeterSetvariable is not a thing. It is only !Setvariable.
Correct that and see what happens. More info after I test your code.
Well, in fact, !RainmeterSetVariable is perfectly valid bang. It's true that the !Rainmeter... bang prefix has been deprecated long time ago, however for backward compatibility reasons it can be used further. Yeah, it is a good idea to be avoided, but if used, it doesn't prevent the skin to work.
David8192 wrote: October 14th, 2021, 1:45 pm Then, under [meterGPUValue] and [meterCPUValue] add DynamicVariables=1.
It should work fine now. Let me know how it goes.
Adding the DynamicVariables=1 option to the meters where the set variables are used is precisely what has to be done. Adding the !UpdateMeter... and !Redraw bangs can improve the code and it's always a good idea to be used (the color setting will go on much quicker), but without them the color setting still should work. Lack of DynamicVariables=1 on the other hand, prevents proper color setting.
And one more which I always recommend to take into account, even if this is not absolutely required. Always recommend to include the set value of the variable into quotes. For instance the first IfAboveValue posted by you above (IfAboveAction=[!SetVariable GPUTEMPColor 255,0,0,255][!UpdateMeter "meterGPUValue"][!Redraw]) would be much better in the following form: IfAboveAction=[!SetVariable GPUTEMPColor "255,0,0,255"][!UpdateMeter "meterGPUValue"][!Redraw]. In this particular case this makes no difference at all, but it's a good habit to get used to add those quotes, because in some circumstances they are required (for example when the string which has to be set contains spaces). Note that a color code (like 255,0,0,255) even if is composed by three or four numbers, is in fact a string (because it contains commas). And a string should always be included into quotes.
User avatar
David8192
Posts: 50
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: Color not working

Post by David8192 »

balala wrote: October 14th, 2021, 5:56 pm Well, in fact, !RainmeterSetVariable is perfectly valid bang. It's true that the !Rainmeter... bang prefix has been deprecated long time ago, however for backward compatibility reasons it can be used further. Yeah, it is a good idea to be avoided, but if used, it doesn't prevent the skin to work.
My bad. :lol: I don't check with deprecated bangs, but good to know. :bow:
"255,0,0,255"
.
Yeah, I should definitely get in the habit.
For some Reason, the square root of X2 does not involve X

the DA GALLERY 8-)
User avatar
balala
Rainmeter Sage
Posts: 13319
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Color not working

Post by balala »

David8192 wrote: October 15th, 2021, 1:44 pm Yeah, I should definitely get in the habit.
Don't misunderstand, omitting the quotes does not affect the bang in this case. But as said, would be a good idea to form the habit of using them.
User avatar
David8192
Posts: 50
Joined: July 8th, 2021, 11:30 pm
Location: The King's Avenue, Golden Kingdom

Re: Color not working

Post by David8192 »

balala wrote: October 15th, 2021, 2:06 pm Don't misunderstand, omitting the quotes does not affect the bang in this case. But as said, would be a good idea to form the habit of using them.
No worries. I understood you. ;-)
For some Reason, the square root of X2 does not involve X

the DA GALLERY 8-)