It is currently December 15th, 2019, 6:20 am

Dynamic CPU Frequency? (and more)

Help with creating, editing & fixing problems with skins
TechFreak1
Posts: 10
Joined: October 22nd, 2019, 1:27 pm

Re: Dynamic CPU Frequency? (and more)

TechFreak1 » November 3rd, 2019, 12:04 pm

Question: is it possible to dynamically change font colour depending on values?

For example as the temp of the CPU gets higher (font colour) the shade of red gets brighter / darker and as it cools down it changes to blue which in turn gets brighter as the CPU cools?
User avatar
jsmorley
Developer
Posts: 19870
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Dynamic CPU Frequency? (and more)

jsmorley » November 3rd, 2019, 5:03 pm

While setting a color dynamically in a string is pretty trivial, I don't see how you create a "transition" effect that does what you want in a graceful way.

There is no graceful transition from Red to Blue in the color spectrum, as it has to go through Purple in one direction, and Yellow and Green in the other.

So you only "transition" within each of the primary colors, and end up with effects like:


1.jpg


Or:
2.jpg

There would have to be a very abrupt change at some point...

Then this gets more complicated, as I suspect you don't want to just go from 255,0,0 to 127,0,0 for "red" and 0,0,127 to 0,0,255 for "blue", which is what I did above. The "primary" colors. The change is not that dramatic. It will more likely end up being mixtures of red, green and blue, which will make for some interesting formulas.
You do not have the required permissions to view the files attached to this post.
User avatar
jsmorley
Developer
Posts: 19870
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Dynamic CPU Frequency? (and more)

jsmorley » November 3rd, 2019, 5:18 pm

You might find it easier to just define some number of [Variables], up to 100, but likely far less, that match a specific color to a specific or range of percentage values that your measure is at...
TechFreak1
Posts: 10
Joined: October 22nd, 2019, 1:27 pm

Re: Dynamic CPU Frequency? (and more)

TechFreak1 » November 3rd, 2019, 5:24 pm

jsmorley wrote:
November 3rd, 2019, 5:03 pm
While setting a color dynamically in a string is pretty trivial, I don't see how you create a "transition" effect that does what you want in a graceful way.

There is no graceful transition from Red to Blue in the color spectrum, as it has to go through Purple in one direction, and Yellow and Green in the other.
Hmm, good point about the pallete transition looks like I need to rethink the design I had in mind.
jsmorley wrote:
November 3rd, 2019, 5:03 pm
So you only "transition" within each of the primary colors, and end up with effects like:



1.jpg



Or:
2.jpg
I see, thanks for the pointers and examples :thumbup:
jsmorley wrote:
November 3rd, 2019, 5:03 pm

Then this gets more complicated, as I suspect you don't want to just go from 255,0,0 to 127,0,0 for "red" and 0,0,127 to 0,0,255 for "blue", which is what I did above. The "primary" colors. The change is not that dramatic. It will end up being mixtures of red, green and blue, which will make for some interesting formulas.
True, it would indeed make for some interesting formulas lol this will keep my boredom at bay for along while :D .
User avatar
jsmorley
Developer
Posts: 19870
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Dynamic CPU Frequency? (and more)

jsmorley » November 3rd, 2019, 5:50 pm

Code: Select all

[Rainmeter]
Update=200
DynamicWindowSize=1
AccurateText=1

[Variables]
Red4=127,0,0
Red3=165,0,0
Red2=200,0,0
Red1=255,0,0
Blue4=0,0,127
Blue3=0,0,255
Blue2=5,80,255
Blue1=100,150,255

[MeasureLoop]
Measure=Loop
StartValue=15
EndValue=100
DynamicVariables=1
IfCondition=[MeasureLoop:%] < 12.5
IfTrueAction=[!SetOption MeterString FontColor "#Blue1#"][!UpdateMeter *][!Redraw]
IfCondition2=([MeasureLoop:%] > 12.5) && ([MeasureLoop:%] <= 25)
IfTrueAction2=[!SetOption MeterString FontColor "#Blue2#"][!UpdateMeter *][!Redraw]
IfCondition3=([MeasureLoop:%] > 25) && ([MeasureLoop:%] <= 37.5)
IfTrueAction3=[!SetOption MeterString FontColor "#Blue3#"][!UpdateMeter *][!Redraw]
IfCondition4=([MeasureLoop:%] > 37.5) && ([MeasureLoop:%] <= 50)
IfTrueAction4=[!SetOption MeterString FontColor "#Blue4#"][!UpdateMeter *][!Redraw]
IfCondition5=([MeasureLoop:%] > 50) && ([MeasureLoop:%] <= 62.5)
IfTrueAction5=[!SetOption MeterString FontColor "#Red1#"][!UpdateMeter *][!Redraw]
IfCondition6=([MeasureLoop:%] > 62.5) && ([MeasureLoop:%] <= 75)
IfTrueAction6=[!SetOption MeterString FontColor "#Red2#"][!UpdateMeter *][!Redraw]
IfCondition7=([MeasureLoop:%] > 75) && ([MeasureLoop:%] <= 87.5)
IfTrueAction7=[!SetOption MeterString FontColor "#Red3#"][!UpdateMeter *][!Redraw]
IfCondition8=[MeasureLoop:%] > 87.5
IfTrueAction8=[!SetOption MeterString FontColor "#Red4#"][!UpdateMeter *][!Redraw]

[MeterString]
Meter=String
MeasureName=MeasureLoop
FontSize=50
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
AntiAlias=1
DynamicVariables=1
Text=%1 | [MeasureLoop:%,1]%


GIF.gif
You do not have the required permissions to view the files attached to this post.
TechFreak1
Posts: 10
Joined: October 22nd, 2019, 1:27 pm

Re: Dynamic CPU Frequency? (and more)

TechFreak1 » November 3rd, 2019, 9:55 pm

Awesome, thanks! :o :thumbup: :great:
TechFreak1
Posts: 10
Joined: October 22nd, 2019, 1:27 pm

Re: Dynamic CPU Frequency? (and more)

TechFreak1 » November 3rd, 2019, 11:19 pm

Was able to adapt the code after abit of tweaking :thumbup: :thumbup:

Image

Image

Code: Select all


[CPUTempStyle]
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=0,0,0,1
FontFace=#CPUTempFont#
FontColor=#CPUTemp#
StringAlign=LEFT
AntiAlias=1
DynamicVariables=1
Hidden=0
Percentua1=1

[MeasureTemp]
Measure=Plugin
Plugin=HWiNFO
HWiNFOSensorId=#CPUTempSensorId#
HWiNFOSensorInstance=#CPUTempSensorInstance#
HWiNFOEntryId=#CPUTempEntryId#
HWiNFOType=#CPUTempType#
UpdateDivider=5
DynamicVariables=1
StartValue=0
EndValue=100
IfCondition=[MeasureTemp:1] < 12.5
IfTrueAction=[!SetOption CPUTempLabel FontColor "#Blue1#"][!UpdateMeter *][!Redraw]
IfCondition2=([MeasureTemp:1] > 12.5) && ([MeasureTemp:1] <= 25)
IfTrueAction2=[!SetOption CPUTempLabel FontColor "#Blue2#"][!UpdateMeter *][!Redraw]
IfCondition3=([MeasureTemp:1] > 25) && ([MeasureTemp:1] <= 37.5)
IfTrueAction3=[!SetOption CPUTempLabel FontColor "#Blue3#"][!UpdateMeter *][!Redraw]
IfCondition4=([MeasureTemp:1] > 37.5) && ([MeasureTemp:1] <= 50)
IfTrueAction4=[!SetOption CPUTempLabel FontColor "#Blue4#"][!UpdateMeter *][!Redraw]
IfCondition5=([MeasureTemp:1] > 50) && ([MeasureTemp:1] <= 62.5)
IfTrueAction5=[!SetOption CPUTempLabel FontColor "#Red1#"][!UpdateMeter *][!Redraw]
IfCondition6=([MeasureTemp:1] > 62.5) && ([MeasureTemp:1 <= 75)
IfTrueAction6=[!SetOption CPUTempLabel FontColor "#Red2#"][!UpdateMeter *][!Redraw]
IfCondition7=([MeasureTemp:1] > 75) && ([MeasureTemp:1] <= 87.5)
IfTrueAction7=[!SetOption CPUTempLabel FontColor "#Red3#"][!UpdateMeter *][!Redraw]
IfCondition8=[MeasureTemp:1 > 87.5
IfTrueAction8=[!SetOption CPUTempLabel FontColor "#Red4#"][!UpdateMeter *][!Redraw]

[CPUTempLabel]
Meter=String
MeterStyle=CPUTempStyle
Text=[MeasureTemp:1]°C
X=160
Y=11
Edit: added second Gif.