ColorRotate
Posted: August 26th, 2017, 4:07 am
This requires at least the r2858 4.1 beta of Rainmeter from https://www/rainmeter.net.
Use Lua to rotate through the 360° "hue" of the HSB color space.
So this will transition through red > yellow > green > cyan > blue > purple and back to red.
The "saturation" and "brightness" can be set to some desired static value from 0.0 to 1.0, a percentage.
ColorRotate.ini:
ColorRotate.lua:
https://docs.rainmeter.net/manual-beta/lua-scripting/inline-lua/
This also includes a library HSBLib.lua, to convert back and forth from RGB to HSB. This is more or less a "black box", and you should not have to deal with it.
Use Lua to rotate through the 360° "hue" of the HSB color space.
So this will transition through red > yellow > green > cyan > blue > purple and back to red.
The "saturation" and "brightness" can be set to some desired static value from 0.0 to 1.0, a percentage.
ColorRotate.ini:
Code: Select all
[Rainmeter]
Update=50
DynamicWindowSize=1
AccurateText=1
[Metadata]
Name=ColorRotate
Author=JSMorley
Information=Use Lua to rotate through the 360° "hue" of the HSB color space.|So this will transition through red > yellow > green > cyan > blue > purple and back to red.||The "saturation" and "brightness" can be set to some desired static value from 0.0 to 1.0, a percentage.
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.5
MyBrightness=1.0
[MeterMyImage]
Meter=Image
W=100
H=100
SolidColor=[MeasureMyColor]
DynamicVariables=1
[MeterMyString]
Meter=String
X=15R
Y=17
FontSize=30
FontWeight=400
FontColor=[MeasureMyColor]
AntiAlias=1
DynamicVariables=1
Text=Color is: [MeasureMyColor]#CRLF#Hue is: [&MeasureMyColor:currentHue]°
Code: Select all
function Initialize()
dofile(SKIN:GetVariable('@')..'HSBLib\\HSBLib.lua')
huePercent = 0.0
saturation = SELF:GetOption('MySaturation') or 1.0
brightness = SELF:GetOption('MyBrightness') or 1.0
end
function Update()
red, green, blue = HSBtoRGB(huePercent, saturation, brightness)
currentHue = Round(360 * huePercent)
huePercent = Clamp(huePercent + 0.005, 0.0, 1.0)
if huePercent == 1.0 then huePercent = 0.0 end
return red..','..green..','..blue
end
This also includes a library HSBLib.lua, to convert back and forth from RGB to HSB. This is more or less a "black box", and you should not have to deal with it.