Created
April 17, 2021 16:32
-
-
Save FaberVitale/e8f30efcd9f48ab8b2a022b2981b5ad4 to your computer and use it in GitHub Desktop.
Color picker - Windows | Autohotkey
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
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
; Color Picker | |
; Usage: place mouse pointer over desired color then input "Win key + \ ", | |
; The picked color will be on the clipboard in rbg format | |
; https://www.autohotkey.com/docs/KeyList.htm | |
CoordMode, PixelGetColor, Screen | |
CoordMode, MouseGetPos, Screen | |
CoordMode, ToolTip, Screen | |
#\::getColor() | |
getColor() | |
{ | |
xPos := "" | |
yPos := "" | |
pickedCol := "" | |
MouseGetPos, xPos, yPos | |
PixelGetColor, pickedCol, xPos, yPos, RGB | |
xTtip := xPos + 10 | |
yTtip := yPos + 5 | |
ToolTip, color picked!, xTtip, yTtip | |
SetTimer, FOLLOW_MOUSE, 16 | |
Clipboard := hexToRgb(pickedCol) | |
SetTimer, HIDE_TOOLTIP, 800 | |
} | |
hexToRgb(hex) | |
{ | |
red := hex >> 16 | |
green:= (hex & 0xFF00) >> 8 | |
blue:= hex & 0xFF | |
return "rgb(" . red . ", " . green . ", " . blue . ")" | |
} | |
FOLLOW_MOUSE: | |
followMouse () | |
{ | |
xPos := "" | |
yPos := "" | |
MouseGetPos, xPos, yPos | |
xTtip := xPos + 10 | |
yTtip := yPos + 5 | |
ToolTip, color picked!, xTtip, yTtip | |
return | |
} | |
HIDE_TOOLTIP: | |
hideTooltip () | |
{ | |
SetTimer, FOLLOW_MOUSE, Off | |
SetTimer, HIDE_TOOLTIP, Off | |
ToolTip | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
u did a great job bro. I like it