It is currently November 15th, 2019, 3:47 am

Hue Color Rotation with Time

Tips and Tricks from the Rainmeter Community
User avatar
iNjUST
Posts: 118
Joined: June 20th, 2012, 12:44 am

Hue Color Rotation with Time

iNjUST » July 13th, 2013, 6:18 pm

Create a time-calculated color that transitions through the HSV spectrum. You can choose what color it starts on, how bright it is (Value), how saturated (Saturation), what portion of the spectrum to use (all of it, or just a few colors), and how long you want it to take to transition from start to finish (I set a default of 1 hour, but you could do one minute (1/60), or 24 hours if you wish).

Code: Select all

[Metadata]
Author=Justin Ware (injust29.deviantart.com)
Information=Hue Rotation
License=CC BY-NC-SA

[Variables]
; Starting color/hue [0 - 5]
; 0 = Red, 1 = Orange, 2 = Yellow, 3 = Green, 4 = Blue, 5 = Magenta
; In-between values permitted (e.g. 3.5 would be a cyan color)
HueStart=0
; Value [0 - 255]
Val=255
; Saturation [0 - 1]
Sat=1.0
; Chroma
C=#Val#*#Sat#
; Direction of hue rotation
; (1) = Forward, (-1) = Backward
HueDir=(1)
; Range of hue rotation [0 - 6]
; 6 = full spectrum, 1 = one color, 2 = two colors, etc. 
; (of the 6 primary/secondary colors)
HueRange=6
; Period of time (in hours) over which the color rotates [0-24]
Period=1
; colors (hue rotation)
color1="[R1:0],[G1:0],[B1:0]"

[mTime]
Measure=Time

[cHue1]
Group=Hue
Measure=Calc
Formula=(#HueStart#+6+#HueDir#*#HueRange#*FRAC(mTime/(3600*#Period#)))%6

[X1]
Measure=Calc
Formula=(#C#*(1-ABS(cHue1%2-1)))
[R1]
Measure=Calc
Formula=(cHue1<1) ? (#Val#) : ((cHue1<2) ? (X1+#Val#-#C#) : ((cHue1<3) ? (#Val#-#C#) : ((cHue1<4) ? (#Val#-#C#) : ((cHue1<5) ? (X1+#Val#-#C#) : (#Val#) ))))
[G1]
Measure=Calc
Formula=(cHue1<1) ? (X1+#Val#-#C#) : ((cHue1<2) ? (#Val#) : ((cHue1<3) ? (#Val#) : ((cHue1<4) ? (X1+#Val#-#C#) : ((cHue1<5) ? (#Val#-#C#) : (#Val#-#C#) ))))
[B1]
Measure=Calc
Formula=(cHue1<1) ? (#Val#-#C#) : ((cHue1<2) ? (#Val#-#C#) : ((cHue1<3) ? (X1+#Val#-#C#) : ((cHue1<4) ? (#Val#) : ((cHue1<5) ? (#Val#) : (X1+#Val#-#C#) ))))
You can now use this color how you wish, for example:

Code: Select all

SolidColor=#color1#
DynamicVariables=1
Enjoy! I'd love to see the ways anyone puts this to use.
trtlhed
Posts: 1
Joined: February 1st, 2016, 5:00 am

Re: Hue Color Rotation with Time

trtlhed » February 1st, 2016, 5:04 am

How do I use this? Sorry I am very inexperienced.
User avatar
balala
Rainmeter Sage
Posts: 9052
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Hue Color Rotation with Time

balala » February 3rd, 2016, 3:25 pm

Sorry for this late reply, I just read your question.
To can use iNjUST's code, first you have to have installed Rainmeter (preferably the newest version). Then here you can find a good description how to create skins.
When you created the ini file, open it, copy iNjUST's code and paste it to the ini file. Also add to the same ini file, a meter, something like:

Code: Select all

[MeterColor]
Meter=Image
X=0
Y=0
W=150
H=150
SolidColor=#color1#
DynamicVariables=1
After all these are done, load your new skin: right click to Rainmeter tray icon and go to Skins -> your newly created config then click to the apropriate ini file.
Good luck and let me know if something is going wrong.
User avatar
QwopJoans
Posts: 115
Joined: February 6th, 2016, 11:06 pm

Re: Hue Color Rotation with Time

QwopJoans » February 8th, 2016, 3:16 am

I made a simple color changing wallpaper skin using your code, drawing inspiration from "What Colour is it?" http://whatcolourisit.scn9a.org/ that can be found at http://qwopjoans.deviantart.com/art/ColorBackGround-1-0-589447045.