SetKeyDelay, 0
;Set starting default value, Just a random colour
RGBval:=RGB(Rval:=44,Gval:=197,Bval:=89)
R1G1B1val:=RGB(R1val:=144,G1val:=17,B1val:=39)
;Create Color GUI
Gui, Add, Text, x0 y10 w40 h20 +Right, Red
Gui, Add, Text, x0 y30 w40 h20 +Right, Green
Gui, Add, Text, x0 y50 w40 h20 +Right, Blue
Gui, Add, Text, x0 y70 w40 h20 +Right, Red
Gui, Add, Text, x0 y90 w40 h20 +Right, Green
Gui, Add, Text, x0 y110 w40 h20 +Right, Blue
Gui, Add, Slider, x40 y10 w190 h20 AltSubmit +NoTicks +Range0-255 vsR gSliderSub, %Rval%
Gui, Add, Slider, x40 y30 w190 h20 AltSubmit +NoTicks +Range0-255 vsG gSliderSub, %Gval%
Gui, Add, Slider, x40 y50 w190 h20 AltSubmit +NoTicks +Range0-255 vsB gSliderSub, %Bval%
Gui, Add, Slider, x40 y70 w190 h20 AltSubmit +NoTicks +Range0-255 vsR1 gSliderSub, %R1val%
Gui, Add, Slider, x40 y90 w190 h20 AltSubmit +NoTicks +Range0-255 vsG1 gSliderSub, %G1val%
Gui, Add, Slider, x40 y110 w190 h20 AltSubmit +NoTicks +Range0-255 vsB1 gSliderSub, %B1val%
Gui, Add, Edit, x230 y10 w45 h20 gEditSub veR +Limit3 +Number, %Rval%
Gui, Add, UpDown, Range0-255 vuR gUpDownSub, %Rval%
Gui, Add, Edit, x230 y30 w45 h20 gEditSub veG +Limit3 +Number, %Gval%
Gui, Add, UpDown, Range0-255 vuG gUpDownSub, %Gval%
Gui, Add, Edit, x230 y50 w45 h20 gEditSub veB +Limit3 +Number, %Bval%
Gui, Add, UpDown, Range0-255 vuB gUpDownSub, %Bval%
Gui, Add, Edit, x230 y70 w45 h20 gEditSub veR1 +Limit3 +Number, %R1val%
Gui, Add, UpDown, Range0-255 vuR1 gUpDownSub, %R1val%
Gui, Add, Edit, x230 y90 w45 h20 gEditSub veG1 +Limit3 +Number, %G1val%
Gui, Add, UpDown, Range0-255 vuG1 gUpDownSub, %G1val%
Gui, Add, Edit, x230 y110 w45 h20 gEditSub veB1 +Limit3 +Number, %B1val%
Gui, Add, UpDown, Range0-255 vuB1 gUpDownSub, %B1val%
Gui, Add, Progress, x285 y10 w60 h60 +Border Background%RGBval% vpC
Gui, Add, Progress, x285 y75 w60 h60 +Border Background%R1G1B1val% vpC1
Gui, Show, w351 h140, Simple Color Dialog
return
EditSub:
;Get Values
GuiControlGet,Rval,,eR
GuiControlGet,Gval,,eG
GuiControlGet,Bval,,eB
GuiControlGet,R1val,,eR1
GuiControlGet,G1val,,eG1
GuiControlGet,B1val,,eB1
;Set preview
gosub set
;Make Everything else aware
GuiControl,,uR,%Rval%
GuiControl,,uG,%Gval%
GuiControl,,uB,%Bval%
GuiControl,,sR,%Rval%
GuiControl,,sG,%Gval%
GuiControl,,sB,%Bval%
GuiControl,,uR1,%R1val%
GuiControl,,uG1,%G1val%
GuiControl,,uB1,%B1val%
GuiControl,,sR1,%R1val%
GuiControl,,sG1,%G1val%
GuiControl,,sB1,%B1val%
return
UpDownSub:
;Get Values
GuiControlGet,Rval,,uR
GuiControlGet,Gval,,uG
GuiControlGet,Bval,,uB
GuiControlGet,R1val,,uR1
GuiControlGet,G1val,,uG1
GuiControlGet,B1val,,uB1
;Set preview
gosub set
;Make Everything else aware
GuiControl,,eR,%Rval%
GuiControl,,eG,%Gval%
GuiControl,,eB,%Bval%
GuiControl,,sR,%Rval%
GuiControl,,sG,%Gval%
GuiControl,,sB,%Bval%
GuiControl,,eR1,%R1val%
GuiControl,,eG1,%G1val%
GuiControl,,eB1,%B1val%
GuiControl,,sR1,%R1val%
GuiControl,,sG1,%G1val%
GuiControl,,sB1,%B1val%
return
SliderSub:
;Get Values
GuiControlGet,Rval,,sR
GuiControlGet,Gval,,sG
GuiControlGet,Bval,,sB
GuiControlGet,R1val,,sR1
GuiControlGet,G1val,,sG1
GuiControlGet,B1val,,sB1
;Set preview
gosub set
;Make Everything else aware
GuiControl,,eR,%Rval%
GuiControl,,eG,%Gval%
GuiControl,,eB,%Bval%
GuiControl,,uR,%Rval%
GuiControl,,uG,%Gval%
GuiControl,,uB,%Bval%
GuiControl,,eR1,%R1val%
GuiControl,,eG1,%G1val%
GuiControl,,eB1,%B1val%
GuiControl,,uR1,%R1val%
GuiControl,,uG1,%G1val%
GuiControl,,uB1,%B1val%
return
set:
;Convert values to Hex
RGBval:=RGB(Rval,Gval,Bval)
R1G1B1val:=RGB(R1val,G1val,B1val)
;Apply colour to preview
GuiControl,+Background%RGBval%,pC
GuiControl,+Background%R1G1B1val%,pC1
return
;Function to convert Decimal RGB to Hexadecimal RBG, Note: '0' (zero) padding is unnecessary
RGB(r, g, b) {
;Shift Numbers
var:=(r << 16) + (g << 8) + b
;Save current A_FormatInteger
OldFormat := A_FormatInteger
;Set Hex A_FormatInteger mode
SetFormat, Integer, Hex
;Force decimal number to Hex number
var += 0
;set original A_FormatInteger mode
SetFormat, Integer, %OldFormat%
return var
}
F5::
send -<c val="%Rval%,%Gval%,%Bval%-%R1val%,%G1val%,%B1val%">
Return