Last active
May 13, 2022 16:56
-
-
Save char101/020c09ac769b9c62c5eec4fe4d3784f5 to your computer and use it in GitHub Desktop.
[Autohotkey] Paste hex color into Windows color picker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HexToDec(h) { | |
SetFormat, integer, D | |
d := 0 | |
d += "0x" h | |
return, d | |
} | |
PasteColor() { | |
c := Clipboard | |
If (RegExMatch(c, "^#[A-Za-z0-9]{6}$")) { | |
r := HexToDec(SubStr(c, 2, 2)) | |
g := HexToDec(SubStr(c, 4, 2)) | |
b := HexToDec(SubStr(c, 6, 2)) | |
; MsgBox %c% -> %r% %g% %b% | |
ControlSetText, Edit4, %r%, A | |
ControlSetText, Edit5, %g%, A | |
ControlSetText, Edit6, %b%, A | |
} else { | |
MsgBox No recognized color found in clipboard | |
} | |
} | |
#IfWinActive Color ahk_class #32770 | |
^v::PasteColor() | |
#IfWinActive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment