Jump to content

Help to get colour picker


Frost128
 Share

Recommended Posts

topic says most of it, I need help to get the colour picker to work because im working on making a thing for gta modding to make alot of stuff easier so if anyone could help i need a script that has the colour picker a pic of the colour and a button to choose the colour

i will take all the help i can get thanks

Link to comment
Share on other sites

topic says most of it, I need help to get the colour picker to work because im working on making a thing for gta modding to make alot of stuff easier so if anyone could help i need a script that has the colour picker a pic of the colour and a button to choose the colour

I'm not sure if I'm understanding you correctly. If you need to get the color on the screen you would use PixelGetColor(). If you needed to pick a color under the mouse cursor for example, you could use it with MouseGetPos().

(Tested) I would think something like:

$pos = MouseGetPos()
$col = PixelGetColor($pos[0], $pos[1])
MsgBox(0, "", "Color @ " & $pos[0] & "," & $pos[1] & " = " & $col)

If that's not what you mean, some clarification is in order (at least for me).

Edited by Lee Bussy
Link to comment
Share on other sites

I meant the colour picker like in ms paint it has rgb boxes and the whole gradient area

this is what im talking about:Posted Image

This code will get you started

CODE
#include <Misc.au3>

#NoTrayIcon

$color = 0

$customcolor = 0

;Create the colour palette

$gui = GUICreate("",500,400,-1,-1,0x80000000+0x00400000,0x00000008+0x00000080)

$label = GUICtrlCreateLabel("",10,5,150,15,-1,0x00100000)

GUICtrlCreateGroup("", 250, 0, 250, 400)

GUICtrlCreatePic("", -1, -1, -1, -1)

GUICtrlSetImage(-1, @ScriptDir & "\colourpalette.jpg", -1, 4) ;Colour Palette Image

GUISetState()

;Colour under mouse pointer

while 1

If _IsPressed("1B") then ExitLoop

$pos = MouseGetPos()

$customcolor = PixelGetColor($pos[0],$pos[1])

if $customcolor <> $color then

GUICtrlSetData($label,"Colour Under Mouse")

GUICtrlSetColor($label,"0x" & Hex($customcolor,6))

$color = $customcolor

EndIf

sleep(10)

WEnd

You can create a colour palette as a *.jpg image. Saves an awful lot of coding. I guess that you could use a digital camera to capture a suitable image. Or capture the image on the screen and use a suitable program to edit out those bits which you do not want and then save it as an image file.

Any other functionality you will have to code. Anyway I hope that it gets you started.

Ant....

Link to comment
Share on other sites

Or since he just wants the Windows color picker, he can do this.

#include <Misc.au3>
$color = _ChooseColor(2, 0x0080ff, 2)

MsgBox(0,'Color',$color)
Like most things in life there is always more than one way of doing something or anything for that matter.

Boy am I glad that I am not a cat or if I lived in New Zealand an opossum.

Thanks for the information - very elegant.

Ant..

Link to comment
Share on other sites

  • 1 month later...

This code will get you started

CODE
#include <Misc.au3>

#NoTrayIcon

$color = 0

$customcolor = 0

;Create the colour palette

$gui = GUICreate("",500,400,-1,-1,0x80000000+0x00400000,0x00000008+0x00000080)

$label = GUICtrlCreateLabel("",10,5,150,15,-1,0x00100000)

GUICtrlCreateGroup("", 250, 0, 250, 400)

GUICtrlCreatePic("", -1, -1, -1, -1)

GUICtrlSetImage(-1, @ScriptDir & "\colourpalette.jpg", -1, 4) ;Colour Palette Image

GUISetState()

;Colour under mouse pointer

while 1

If _IsPressed("1B") then ExitLoop

$pos = MouseGetPos()

$customcolor = PixelGetColor($pos[0],$pos[1])

if $customcolor <> $color then

GUICtrlSetData($label,"Colour Under Mouse")

GUICtrlSetColor($label,"0x" & Hex($customcolor,6))

$color = $customcolor

EndIf

sleep(10)

WEnd

You can create a colour palette as a *.jpg image. Saves an awful lot of coding. I guess that you could use a digital camera to capture a suitable image. Or capture the image on the screen and use a suitable program to edit out those bits which you do not want and then save it as an image file.

Any other functionality you will have to code. Anyway I hope that it gets you started.

Ant....

How should i use and write that color in ini file?

[quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)

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...