It is currently April 19th, 2024, 5:59 am

Any Way to make Rainmeter Skins Changing colors in RGB

Get help with creating, editing & fixing problems with skins
ADRIANNOWHOW
Posts: 2
Joined: August 24th, 2017, 11:12 pm

Any Way to make Rainmeter Skins Changing colors in RGB

Post by ADRIANNOWHOW »

Hello i have a Rainmeter theme and i want to know or it is the Possibility to make the Skin rotating in all RGB Colorst ? Like a RGB Led String ? maybe somone of you know how hehe sorry for my bad english
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Any Way to make Rainmeter Skins Changing colors in RGB

Post by jsmorley »

This is not trivial really. To rotate colors through the spectrum, the best way I know how is to use the HSB (Hue Saturation Brightness) color space instead of the RGB (Red Green Blue) one. That way you can manipulate just the Hue.

I know the effect you are going for, to transition through the spectrum of red, yellow, green, cyan, blue, purple and back to red. Like the LED stuff on a gaming computer.

This can be done, but not easily with just native Rainmeter code. You will want some Lua to help you manage the HSB values, while converting them to RGB for use in the skin.

Here is an example skin, that you can tear apart and hopefully make some use of.

Play with MySauration and MyBrightness to get different effects.

Skin:

Code: Select all

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

[Metadata]
Name=ColorRotate
Author=JSMorley
Information=Use Lua to rotate through the "Hue" of the HSB color space. The "brightness" and "saturation" can be set to some desired initial value.
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Version=August 25, 2017

[MeasureMyColor]
Measure=Script
ScriptFile=ColorRotate.lua
; MySaturation and MyBrightness can be 0.0 (none) to 1.0 (full)
MySaturation=0.75
MyBrightness=1.0
DynamicVariables=1

[MeterMyImage]
Meter=Image
W=100
H=100
SolidColor=[MeasureMyColor]
DynamicVariables=1

[MeterMyString]
Meter=String
X=15R
Y=25
FontSize=30
FontWeight=400
FontColor=[MeasureMyColor]
AntiAlias=1
DynamicVariables=1
Text=Color is: [MeasureMyColor]
Lua:

Code: Select all

function Initialize()

	dofile(SKIN:GetVariable('@')..'HSBLib\\HSBLib.lua')
	
	hue = 0.0
	saturation = SELF:GetOption('MySaturation') or 1.0
	brightness = SELF:GetOption('MyBrightness') or 1.0
	
end

function Update()

	red, green, blue = HSBtoRGB(hue, saturation, brightness)
	
	hue = Clamp(hue + 0.005, 0.0, 1.0)
	if hue == 1.0 then hue = 0.0 end	
	
	return red..','..green..','..blue
	
end

function Clamp(num, lower, upper)

	return math.max(lower, math.min(upper, num))
	
end
This also loads an external HSBLib.lua file that does the conversions from RBG to HSB and back. That is a "plug and play" library, and you shouldn't have to mess with it or even understand it...
ColorRotate_1.0.rmskin
GIF.gif
You do not have the required permissions to view the files attached to this post.
ADRIANNOWHOW
Posts: 2
Joined: August 24th, 2017, 11:12 pm

Re: Any Way to make Rainmeter Skins Changing colors in RGB

Post by ADRIANNOWHOW »

i am so thankfull :D
aredhone
Posts: 38
Joined: November 12th, 2017, 6:03 pm

Re: Any Way to make Rainmeter Skins Changing colors in RGB

Post by aredhone »

So i dont know if this still get awnserd
but how do i change the shape i have no clue if been trying foor days
thanks in advanced

ps im sory english is not my first language
mak_kawa
Posts: 908
Joined: December 30th, 2015, 9:47 am

Re: Any Way to make Rainmeter Skins Changing colors in RGB

Post by mak_kawa »

Hi aredhone

I am not sure what does "change the shape" mean... Change what and how? How does it relate with the color rotation mentioned in this thread?
Could you elaborate about this with posting your code?

Sorry for too many question marks... :-)
aredhone
Posts: 38
Joined: November 12th, 2017, 6:03 pm

Re: Any Way to make Rainmeter Skins Changing colors in RGB

Post by aredhone »

Okay yea
So im completly new to lua
Rainmeter i have used quite a bit

But what i ment by shaoe when you load this skin its a squar
I want to make it round a triangle etc
If lookt through the inni and every where i could thing of to define a shape well hence the quistion did not work
Then i opend the lua script to check if i could change the square shape you start with by somthing else but thats where my brains stops im goning to read up on lua but im not sure if its even there

So the quistion is when i load the skin it starts as a sqeur how i make it round or any other shape
Thanks in advanced

edit:

this code

Code: Select all

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

[Metadata]
Name=ColorRotate
Author=JSMorley
Information=Use Lua to rotate through the "Hue" of the HSB color space. The "brightness" and "saturation" can be set to some desired initial value.
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Version=August 25, 2017

[MeasureMyColor]
Measure=Script
ScriptFile=ColorRotate.lua
; MySaturation and MyBrightness can be 0.0 (none) to 1.0 (full)
MySaturation=0.75
MyBrightness=1.0
DynamicVariables=1

[MeterMyImage]
Meter=Image
W=100
H=100
SolidColor=[MeasureMyColor]
DynamicVariables=1

[MeterMyString]
Meter=String
X=15R
Y=25
FontSize=30
FontWeight=400
FontColor=[MeasureMyColor]
AntiAlias=1
DynamicVariables=1
Text=Color is: [MeasureMyColor]
Last edited by balala on July 25th, 2020, 2:31 pm, edited 1 time in total.
User avatar
Yincognito
Rainmeter Sage
Posts: 7125
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Any Way to make Rainmeter Skins Changing colors in RGB

Post by Yincognito »

aredhone wrote: July 25th, 2020, 9:43 am Okay yea
So im completly new to lua
Rainmeter i have used quite a bit

But what i ment by shaoe when you load this skin its a squar
I want to make it round a triangle etc
If lookt through the inni and every where i could thing of to define a shape well hence the quistion did not work
Then i opend the lua script to check if i could change the square shape you start with by somthing else but thats where my brains stops im goning to read up on lua but im not sure if its even there

So the quistion is when i load the skin it starts as a sqeur how i make it round or any other shape
Thanks in advanced
Here is a Rainmeter code approach, no Lua involved. You change the shape from the Shape option in the [Shape] meter:

Code: Select all

[Variables]
; Increase to update the transition meter slower, increase to update it faster
FastUpdate=25
SlowUpdate=1000
UpdateDivider=(#SlowUpdate#/#FastUpdate#)
; Decrease to make the transition slower, increase to make it faster
Increment=4
; 1 = Standard transition direction, -1 = Inverse transition direction
Direction=1
; 0 = Red, 1 = Blue, 2 = Green (if Direction=1), or 0 = Blue, 1 = Green, 2 = Red (if Direction=-1)
StartColor=0
; Don't modify these
Quantifier=#StartColor#
Alternator=0

[Rainmeter]
Update=#FastUpdate#
DynamicWindowSize=1
AccurateText=1

---Measures---

[Transition]
Disabled=1
Measure=Calc
Formula=((#CURRENTSECTION#+#Increment#)%256)
RegExpSubstitute=1
Substitute="^(.*)$":"(255*(1*(1+(#Direction#))/2+#Alternator#*(1-(#Direction#))/2)-((#Direction#)*(\1)*((1-(#Direction#))/2+(#Direction#)*#Alternator#))),0,(255*(1*(1-(#Direction#))/2+#Alternator#*(1+(#Direction#))/2)+((#Direction#)*(\1)*((1+(#Direction#))/2-(#Direction#)*#Alternator#))),255","^((?:[^,]*,){#Quantifier#})((?:[^,]*,)*)(.*)$":"\2\1\3","\\\d":""
IfCondition=((#CURRENTSECTION#+#Increment#)>=256)
IfTrueAction=[!SetVariable Alternator (1-#Alternator#)][!SetVariable Quantifier ((3+#Quantifier#+#Direction#*#Alternator#*1)%3)]
IfConditionMode=1
DynamicVariables=1

---Meters---

[Shape]
Meter=Shape
;Shape=Rectangle 0,0,200,100,12 | StrokeWidth 0 | Stroke Color 255,255,255,255 | Fill Color [Transition]
Shape=Ellipse 100,100,100,100 | StrokeWidth 0 | Stroke Color 255,255,255,255 | Fill Color [Transition]
LeftMouseUpAction=[!UnpauseMeasure Transition][!ToggleMeasure Transition][!SetVariable Quantifier #StartColor#][!SetVariable Alternator 0][!UpdateMeasure Transition][!UpdateMeter *][!Redraw]
MiddleMouseUpAction=[!TogglePauseMeasure Transition]
DynamicVariables=1

[Text]
Meter=STRING
X=([Shape:W]/2)r
Y=([Shape:H]/2)r
W=([Shape:W])
H=([Shape:H])
FontFace=Tahoma
FontColor=255,255,255,255
FontSize=10
FontWeight=700
AntiAlias=1
StringAlign=CenterCenter
StringEffect=Shadow
StringEffectColor=0,0,0,255
Text="TRANSITION: Color Wheel#CRLF#DIRECTION: #Direction##CRLF#START COLOR: #StartColor##CRLF#INCREMENT: #Increment#"
DynamicVariables=1
Currently it's a disk, but I let a rounded rectangle commented out above, just in case.

P.S. You can do the same in jsmorley's code as well: just replace Meter=Image with Meter=Shape and define your shape in Shape=... option as above.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Any Way to make Rainmeter Skins Changing colors in RGB

Post by balala »

aredhone wrote: July 25th, 2020, 9:43 am But what i ment by shaoe when you load this skin its a squar
I want to make it round a triangle etc
If lookt through the inni and every where i could thing of to define a shape well hence the quistion did not work
Then i opend the lua script to check if i could change the square shape you start with by somthing else but thats where my brains stops im goning to read up on lua but im not sure if its even there

So the quistion is when i load the skin it starts as a sqeur how i make it round or any other shape
Thanks in advanced

edit:

this code

Code: Select all

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

[Metadata]
Name=ColorRotate
Author=JSMorley
Information=Use Lua to rotate through the "Hue" of the HSB color space. The "brightness" and "saturation" can be set to some desired initial value.
License=Creative Commons Attribution-Non-Commercial-Share Alike 3.0
Version=August 25, 2017

[MeasureMyColor]
Measure=Script
ScriptFile=ColorRotate.lua
; MySaturation and MyBrightness can be 0.0 (none) to 1.0 (full)
MySaturation=0.75
MyBrightness=1.0
DynamicVariables=1

[MeterMyImage]
Meter=Image
W=100
H=100
SolidColor=[MeasureMyColor]
DynamicVariables=1

[MeterMyString]
Meter=String
X=15R
Y=25
FontSize=30
FontWeight=400
FontColor=[MeasureMyColor]
AntiAlias=1
DynamicVariables=1
Text=Color is: [MeasureMyColor]
Note that in the above code there is need to use the value returned by the [MeasureMyColor] measure as a section variable. If you use it so, you have to set on the dynamic variables (with the DynamicVariables=1 option), but this doesn't worth. Instead I'd remove the DynamicVariables=1 option, would add a MeasureName=MeasureMyColor option and would modify the Text option to Text=Color is: %1.