Jump to content

ColorInfo


death pax
 Share

Recommended Posts

a quick script i made for my gf... shes a cg artist and is constantly needing to find the hex/rgb values in pictures

figured i might as well share it with y'all as well

#Include <Constants.au3>
#NoTrayIcon
opt("TrayMenuMode",1)
$aboutitem = TrayCreateItem("About")
$exititem = TrayCreateItem("Exit")
TraySetState()
TraySetToolTip("ColorInfo")
While 1
    $msg = TrayGetMsg()
    Select
        Case $msg = $aboutitem
            Msgbox(64,"About:","ColorInfo by DeathPax")
        Case $msg = $exititem
            ExitLoop
    EndSelect
    $pos = MouseGetPos()
    $color=PixelGetColor ( $pos[0] , $pos[1] )
    $Red=BitAND( BitShift($Color, 16), 0xff)
    $Green=BitAND( BitShift($Color, 8), 0xff)
    $Blue=BitAND($Color, 0xff)
    ToolTip("#"&Hex($Color, 6)&@CRLF&"R:"&$Red&@CRLF&"G:"&$Green&@CRLF&"B:"&$Blue)
WEnd
Link to comment
Share on other sites

  • 2 months later...

Nice! Simple and usefull. ;)

Very good.

Só o que posso lhe dizer, bom é quando faz mal!My work:Au3Irrlicht - Irrlicht for AutoItMsAgentLib - An UDF for MSAgentAu3GlPlugin T2 - A 3D plugin for AutoIt...OpenGl Plugin - The old version of Au3GlPlugin.MAC Address Changer - Changes the MAC AddressItCopter - A dragonfly R/C helicopter simulator

VW Bug user

Pinheiral (Pinewood) city:

http://pt.wikipedia.org/wiki/Pinheiral

Link to comment
Share on other sites

I made a similar program long time ago using a small window that moved next to the mouse showing actually the color in a 20x20 label + the hex-value (it also changed the color depending on the darkness of the color so it was always readable ;) ).

Maybe i can find that old script

Though it's a nice little script :evil:

#include <GUIConstants.au3>

HotKeySet("{ESC}", "Quit")
HotKeySet("{F5}", "F5")
HotKeySet("{F6}", "F6")

MsgBox(0,"Copyright:","This Program Was Made by FaNtA" & @LF & @LF & "Esc to exit" & @LF &"F5 To Get RGB Code" & @LF &"F6 To Get Hexcode")

Global $GUI_Pixel[400]
Global $GUI = GUICreate("Colorpicker",80,80,0,0,$WS_POPUP+$WS_BORDER,$WS_EX_TOPMOST)
Global $LastPos[2] = [0,0]
Global $switcher

$label = GUICtrlCreateLabel("",0,0,80,80)
$label2 = GUICtrlCreateLabel("",25,35,40,15)
GUISetState(@SW_SHOW)

    #region <Label>
    $MousePos = MouseGetPos()
    GUICtrlSetBkColor($label,PixelGetColor($MousePos[0],$MousePos[1]))
        If Dec(PixelGetColor($mousePos[0],$MousePos[1])) < Dec(0x7F7F7F) Then
    GUICtrlSetData($label2,StringTrimLeft(Hex(PixelGetColor($MousePos[0],$MousePos[1])),2))
    GUICtrlSetColor(-1,0xffFFFF)
    GuiCtrlSetBkColor($label2,$GUI_BKCOLOR_TRANSPARENT)
        Else
    GUICtrlSetData($label2,StringTrimLeft(Hex(PixelGetColor($MousePos[0],$MousePos[1])),2))
    GUICtrlSetColor(-1,0x000000)
    GuiCtrlSetBkColor($label2,$GUI_BKCOLOR_TRANSPARENT)
        EndIf
    #endregion

While 1
    $MousePos = MouseGetPos()

    If ($LastPos[0] <> $MousePos[0] Or $LastPos[1] <> $MousePos[1]) Then
        If $MousePos[0] < @DesktopWidth-95 AND $MousePos[1] < @DesktopHeight-80 Then
            WinMove("Preview","",$MousePos[0]+15,$MousePos[1])
        ElseIf $MousePos[0] > @DesktopWidth-95 AND $MousePos[1] > @DesktopHeight-80 Then
            WinMove("Preview","",@DesktopWidth-80,$MousePos[1]-95)
        ElseIf $MousePos[0] > @DesktopWidth-95 Then
            WinMove("Preview","",@DesktopWidth-80,$MousePos[1]+15)
        Elseif $MousePos[1] > @DesktopHeight-80 Then
            WinMove("Preview","",$MousePos[0]+15,@DesktopHeight-80)

        EndIf
            $LastPos[0] = $MousePos[0]
            $LastPos[1] = $MousePos[1]
    #region <Making the Label>
    $MousePos = MouseGetPos()
    GUICtrlSetBkColor($label,PixelGetColor($MousePos[0],$MousePos[1]))
        If Dec(PixelGetColor($mousePos[0],$MousePos[1])) < Dec(0x7F7F7F) Then
    GUICtrlSetData($label2,StringTrimLeft(Hex(PixelGetColor($MousePos[0],$MousePos[1])),2))
    GUICtrlSetColor(-1,0xffFFFF)
    GuiCtrlSetBkColor($label2,$GUI_BKCOLOR_TRANSPARENT)
        Else
    GUICtrlSetData($label2,StringTrimLeft(Hex(PixelGetColor($MousePos[0],$MousePos[1])),2))
    GUICtrlSetColor(-1,0x000000)
    GuiCtrlSetBkColor($label2,$GUI_BKCOLOR_TRANSPARENT)
        EndIf
    #endregion

EndIf
    
    Sleep(10)
WEnd

Func Quit()
    $switcher = Not $switcher
        While $switcher
            GUISetState(@SW_Hide)
        WEnd
    GUISetState(@SW_Show)
EndFunc

Func F5()
    $MousePos = MouseGetPos()
    ClipPut("("& Dec(StringMid(Hex(PixelGetColor($MousePos[0],$MousePos[1])),3,2)) &","& _
    Dec(StringMid(Hex(PixelGetColor($MousePos[0],$MousePos[1])),5,2)) &","& _
    Dec(StringMid(Hex(PixelGetColor($MousePos[0],$MousePos[1])),7,2)) &")")
    ToolTip("RGB-Code successfully saved into the Clipboard")
EndFunc

Func F6()
    $MousePos = MouseGetPos()
    ClipPut(StringTrimLeft(Hex(PixelGetColor($MousePos[0],$MousePos[1])),2))
    ToolTip("Hexcode successfully saved into the Clipboard")
EndFunc

It was one of my first scripts and i used the mouse magnifier script by someone as the base, though i can't remember the name :lmao:

Edited by XxXFaNtA
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...