Question : ahk color picker
Answered by : richard-lievesley
#SingleInstance force
SetFormat, integer, hex
Gui, Add, Slider , x12 y19 w90 h20 vPipboyRed gSetColour Range0-255, 128
Gui, Add, Slider, x12 y59 w90 h20 vPipboyGreen gSetColour Range0-255, 128
Gui, Add, Slider, x12 y99 w90 h20 vPipboyBlue gSetColour Range0-255, 128
gosub,SetColour ;Set the default colour to what's defined above.
Gui, Add, Edit, x112 y19 w120 h100
Gui, Show, h147 w247
SetFormat, integer, d
Return
SetColour: SetFormat, integer, hex gui,submit,nohide PipboyRed := GetHexGUIColour(PipboyRed) PipboyGreen := GetHexGUIColour(PipboyGreen) PipboyBlue := GetHexGUIColour(PipboyBlue) Gui, Color,, %PipboyRed%%PipboyGreen%%PipboyBlue% tooltip Red:%PipboyRed%`nGreen:%PipboyGreen%`nBlue:%PipboyBlue% return
GuiClose:
ExitApp
GetHexGUIColour(InputNumber) ;Converts "0x0F" to "0F" and "1" to "01"
{ InputNumber := strreplace(InputNumber,"0x") if StrLen(InputNumber) = 1 return "0" . InputNumber else return InputNumber
}
Source : | Last Update : Sat, 20 Aug 22