Jump to content
Sign in to follow this  


Recommended Posts

OK, i made this utillity a few weeks ago and i use it a lot. Since i use it quite a bit, im gonna post it here for you guys to enjoy. What it does is allows you to grab the HTML colour code for any colour on your screen by dragging your mouse over the colour you want then freezing the display and copying it to your clipboard with a simple button.


Push CTRL+F to freeze/Un-Freeze the colour display.

Push "Copy Colour Code To Clipboard" to copy the selected colour code to your clipboard (Example: #00FF00)

and thats pretty much it.

Here is the code:

#include <GUIConstants.au3>

hotkeyset("^f", "freeze")

$parent = GUICreate("Parent")
$colour_pick = GUICreate("AutoColor", 305, 96, @desktopwidth - 307, @desktopheight - 20 - 130, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE), $parent)
$current_colour = GUICtrlCreateLabel("", 6, 10, 87, 79)
GUICtrlSetBkcolor(-1, 0xFFFFFF)
GUICtrlCreateLabel("HTML Colour Code:", 106, 12, 102, 17)
$text_colourcode = GUICtrlCreateInput("#FF00FF", 200, 10, 55, 21)
$copy_toclip = GUICtrlCreateButton("Copy Colour Code To Clipboard", 96, 32, 175, 17, 0)
GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif")
$status = GUICtrlCreateLabel("", 96, 62, 175, 17, $SS_CENTER)

global $freezing = 0
$colour = ""

While 1
    $nMsg = GUIGetMsg()
    if $nmsg = $GUI_EVENT_CLOSE then Exit
    if $nmsg = $copy_toclip then copyit()

$mouse = MouseGetPos ()
    if PixelGetcolor( $mouse[0] , $mouse[1] ) <> $colour and not $freezing then
    $mouse = MouseGetPos ()
    $colour = PixelGetcolor( $mouse[0] , $mouse[1] )
    GUICtrlSetBkcolor($current_colour, $colour)
    guictrlsetdata($text_colourcode, "#" & Hex($colour, 6))

func copyit()
$colour = guictrlread($text_colourcode)

    if ClipPut ($colour) then
    guictrlsetdata($status, "Copyed "&$colour&" To ClipBoard")
    guictrlsetdata($status, "Error Coping colourcode to clipboard.")

func freeze()
    if $freezing then
    global $freezing = 0
    guictrlsetdata($status, "Freeze Off")
    global $freezing = 1
    guictrlsetdata($status, "Freeze On")

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...