Cedeq Community Forum
Keyboard Shortcut - Find out the Hex Color Code anywhere on Screen - Printable Version

+- Cedeq Community Forum (https://cedeq.com/forums)
+-- Forum: General (https://cedeq.com/forums/forumdisplay.php?fid=1)
+--- Forum: Keyboard shortcuts with AutoHotkey code (https://cedeq.com/forums/forumdisplay.php?fid=4)
+--- Thread: Keyboard Shortcut - Find out the Hex Color Code anywhere on Screen (/showthread.php?tid=23)



Keyboard Shortcut - Find out the Hex Color Code anywhere on Screen - denilama - 03-20-2018

If you are a web developer or a graphic designer, you probably have color related tasks. There are plenty of fancy GUI-tools to help you with that. But if you just need to quickly find out the hexadecimal color code (RGB) at any point on your screen, this small script will do the job. Simply move the mouse pointer to the desired location, and use the keyboard shortcut to run the script.

Need help creating a keyboard shortcut with ShortKeeper using the following AutoHotkey code? This 5-minute tutorial will help!
MouseGetPos, MouseX, MouseY
PixelGetColor, color, %MouseX%, %MouseY%, Slow|RGB
Clipboard := color
MsgBox % "The color at the current cursor position is " color "."

The color will be shown in a dialog box and placed in the clipboard.

At the end of line #2, RGB can be replaced with BGR to swap the red and blue components.

The color will be shown in hexadecimal format (e.g., 0xFFFFFF). If you would like to remove the “0x” prefix, add the following instruction between lines #1 and #2:
StringTrimLeft, color, color, 2