So this is something I whipped up while looking for a cool looking color picker on the forums for a project I'm working on.
http://www.autohotkey.net/~jamixzol/colorpicker4ahk.jpg
It uses PixelGetColor on a splash GUI to use as a color picker. It's not super practical, but it catches the eye. A great deal of this script is from another color picker, which I cannot seem to locate the post now...
So if you recognize the tooltip box please post it here so I can link the post.
Everything else is in the source:
Code:
/*
Flashy and impractical color picker
Build (0.1)
Released (12.16.10)
Framework
(
Written in AHK_L (Version v1.0.48.05.L61)
www.autohotkey.net/~Lexikos/AutoHotkey_L
©2003-2009 Chris Mallett, portions ©AutoIt Team and various AHK community members
)
Platforms tested (XP_32+64)
Language (English native + os dependent)
Author (The Naked General _ jamixzol@gmail.com)
DEPENDENCIES:
the colorpicker4ahk.jpg located at www.autohotkey.net/~jamixzol/colorpicker4ahk.jpg
It is written in AHK_L COM compliant syntax
TEST ENVIRONMENT:
Built and tested in Windows XP X64 sp3. Written in AHL_L_10.48.05.L61 with SciTE4AHK
*/
; This uses the image as a pallet
Gui, -Caption +ToolWindow +LastFound +AlwaysOnTop
GUI, add, pic, , colorpicker4ahk.jpg ;assumed to be in the directory with the script
Gui, Show
Gui, Color, 000000
;WinSet, TransColor, FFFFFF (This didn't work lawls)
;This is the color frame initialization
Gui, 2:-Caption +ToolWindow +LastFound +AlwaysOnTop
Gui, 2:Font, s12 cBlack ;Set font size & color
Gui, 2:Add, Text, x5 y5 w75 center vupdatetxt, FFFFFF
;Initialize this if you call it from somewhere else
showpad=1
Loop
{
CoordMode, Mouse, Screen
MouseGetPos X, Y
PixelGetColor Color, X, Y, RGB
ColorD := Color ;build an int based variable
StringRight, color, color, 6 ;removes 0x prefix
SetFormat, IntegerFast, d
ColorD += 0 ; Sets Var (which previously contained 11) to be 0xb.
ColorD .= "" ; Necessary due to the "fast" mode.
Gui, 2:Color, %color%
CoordMode, Pixel
mx := X - 90
my := Y - 40
Gui, 2:-Caption +ToolWindow +LastFound +AlwaysOnTop +Border
Gui, 2:Show, NoActivate x%mX% y%mY% w85 h30
if (ColorD < 3158064)
{
Gui, 2:Font, cWhite ; If desired, use a line like this to set a new default font for the window.
GuiControl, 2:Font, updatetxt
}
if (ColorD >= 3158064)
{
Gui, 2:Font, cBlack
GuiControl, 2:Font, updatetxt ; Put the above font into effect for a control.
}
guicontrol,2: , updatetxt, %color% ;Update the text
Sleep 50
}Until showpad=0 ;WARNING AHK_L SYNTAX
~lButton:: ; Set the shortcut to be used to catch the color under mouse.
SetTimer, killgui, 500
;messagebox BONK
If (showpad=1)
MsgBox The color you picked is 0x%color% ;final color chosen
;Clipboard = %color% ;or stick it to the clipboard
showpad=0 ;break the loop
Return
esc::
Pause
Return ;just in case of emergency
;tell your GUIs to step up off
killgui:
gui, hide
gui, 2:hide
If (showpad=0) ;waiting for the bonk
{
ExitApp ;^ or just hide them
SetTimer, killgui, Off ;stop killing stuff
}
Else
SetTimer, killgui, 500 ;kill away
Return
As always suggestions, comments, criticism or kudos are very welcome.
