I am practicing to transform the existing color picker.(Author = raiguard)
I'm designing and I want to convert sunrise images to color code. That's the job for it.
I want to know the color change every 5 seconds at the points X = 400 and Y = 400.
The current color picker has to press the eyedropper and then click on the cursor to see its value.
1. In the example Lua script, i want to know how to determine the x, y coordinates instead of the cursor position.
2. In the example Luascript, I want to know how to produce the result without the last click.
3. I want to know how to execute a command every 5 seconds instead of LeftMouseUpAction =.
I'm attaching a skin in practice.
I left only the essential parts of the skin.
I need your help.
ColorPickerPlus.lua
Code: Select all
-- setup data structure and some constants, set initial rgb value
function Initialize()
colors = {}
end
function Update() end
function GetColor(key) return colors[key] or 0 end
function SetRGB(...)
if arg.n == 1 then
colors.cur_rgb = arg[1]
colors.cur_r, colors.cur_g, colors.cur_b = string.match(colors.cur_rgb, '(%d+),(%d+),(%d+)')
else
colors['cur_' .. arg[1]] = arg[3] and arg[2] or Round(Clamp((SKIN:ParseFormula(arg[2]) * 255),0,255),0)
colors.cur_rgb = string.format('%s,%s,%s', colors.cur_r, colors.cur_g, colors.cur_b)
end
SetScrubbers()
SKIN:Bang('!Update')
-- SKIN:Bang('!UpdateMeterGroup', 'ColorMeters')
-- SKIN:Bang('!Redraw')
end
function SetHSB(...)
if arg.n == 1 then
colors.cur_hsb = arg[1]
else
colors['cur_' .. arg[1]] = Clamp(SKIN:ParseFormula(arg[2]),0,1)
colors.cur_hsb = string.format('%s,%s,%s', colors.cur_hue, colors.cur_sat, colors.cur_bri)
end
colors.cur_rgb = string.format('%s,%s,%s', HSBtoRGB(colors.cur_hue, colors.cur_sat, colors.cur_bri))
colors.cur_r, colors.cur_g, colors.cur_b = string.match(colors.cur_rgb, '(%d+),(%d+),(%d+)')
colors.cur_hex = RGBtoHEX(colors.cur_r, colors.cur_g, colors.cur_b)
end
function ChangeRGB(key, delta)
SetRGB(key, Clamp(colors['cur_' .. key] + delta, 0, 255), true)
end
ColorPickerPlus.ini
Code: Select all
[Rainmeter]
Update=100
MiddleMouseUpAction=[!Refresh]
OnRefreshAction=[!ZPos 1]
AccurateText=1
[Metadata]
[Variables]
; ==================================================
; MEASURES
[MeasureScript]
Measure=Script
ScriptFile=Extra\Scripts\ColorPickerPlus.lua
[MeasureScreenshot]
Measure=Plugin
Plugin=RunCommand
Parameter=nircmd savescreenshotfull C:\Windows\Temp\colorpickerplus-capture.png
StartInFolder=#CURRENTPATH#Extra
FinishAction=[!ActivateConfig "[#CURRENTCONFIG]\Eyedropper"][!SetVariable parentConfig "[#CURRENTCONFIG]" "[#CURRENTCONFIG]\Eyedropper"][!UpdateMeter MeterOverlay "[#CURRENTCONFIG]\Eyedropper"]
; ==================================================
[MeterEyedropperButton]
Meter=Shape
LeftMouseUpAction=[!CommandMeasure MeasureScreenshot "Run"]
MeterStyle=StyleIcon | StyleIcon_Eyedropper
[StyleIcon]
X=0
Y=0
W=20
H=20
Antialias=1
MouseOverAction=[!SetOption #CURRENTSECTION# Fill "Fill Color [#colorHover_[#CURRENTSECTION]]"][!UpdateMeter #CURRENTSECTION#][!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# Fill ""][!UpdateMeter #CURRENTSECTION#][!Redraw]
DynamicVariables=1
Fill=Fill Color #colorMain#
[StyleHeaderIcon]
W=30
@includeIcons=#CURRENTPATH#Extra\Icons.inc
; ==================================================
[Measure_RGB1]
Measure=String
String=[&MeasureScript:GetColor('cur_rgb')]
IfMatch=135.100.184
IfMatchAction=!Execute[!SetOption MeterForCheck2 Text "Ture"][!Redraw]
IfNotMatchAction=!Execute[!SetOption MeterForCheck2 Text "False"][!Redraw]
IfMatchMode=1
RegExpSubstitute=1
DynamicVariables=1
[MeterForCheck]
meter=String
MeasureName=Measure_RGB1
Text=%1
SolidColor=255,255,255,50
AntiAlias=1
ClipString=2
UpdateDivider = 1
DynamicVariables = 1
X=30
Y=0
W=100
[MeterForCheck2]
meter=String
MeasureName=Measure_RGB1
Text=%1
SolidColor=255,255,255,50
AntiAlias=1
ClipString=2
UpdateDivider = 1
DynamicVariables = 1
X=30
Y=20
W=100