color pickin chooser

A color picker for your Windows desktop, or in your AutoIt applications

screenshot image of color pickin chooser
This all started because I couldn't find an AutoIt color chooser that really cut it for me, and then I couldn't get the Windows built-in color chooser to do what it's told - nothing new there.

And THAT started because I wanted to make a really good schemes preference dialog for my clock. And so it goes..

Then I stopped and thought about how I'd like a color picker to really be, and BANG! There goes my weekend, and then some! But I think it was worth it; as well as a cool desktop color picker app, I have something I can re-use any time I need a color picker in an AutoIt application.

The color pickin chooser is available as a windows application, a source "pack", which has everything you need to build and use color picking chooser yourself; source code, includes, icons, sample images and what-not, and as plain source code. Have fun!

 

Features..

User-definable color picking images..

All available from a handy context (right-click) menu.

Import images as easily as a drag & drop.

Comes with a selection of sample pickers.

And more!

Luminance gradient selection..

The smoothest gradient selector on planet earth, well, smooth.

With live luminance facility (F5)

Built-in magnifier..

With live mag facility (F6)

Includes "super-mag" for out-of-gui pixel capture.

Live hex tool tips and title bar..

(or whatever output format you specify)

Hold down SHIFT to see live color values in your chosen output format, with or without prefix, as required.

User-definable color groups..

You can save colors in any number of color groups.

Keep all your color schemes in one handy central location. Groups can be created, copied, edited and deleted, colors created, renamed, and deleted, all from within the gui.

Advanced color sorting..

You can sort the colors in your group by name, by Red, Green or Blue values, or by Hue, Saturation, or Lightness values.

Repeat the sort to sort in reverse!

Unpatented 'Duplex Fuzzy-Algo Multi-Sort™' functionality enables you to mix-and-match your sort routines to get the color order exacitaly right! No really, try it!

Handy HotKey controls for all sort functions make sorting quick and easy.

Drag & drop import of color schemes..

easy export/backup and restore (drag & drop) of color groups.

share color groups with others, just drag & drop.

Drag & drop ini files to suck colors from other program's preferences, even whole folders of files (non-ini's are ignored)

"merge" functionality, so you can distribute color group files that users can simply drag in.

Palette support (GIMP .gpl and JASC .pal)..

Export colors as cpc color groups or color palettes.

Drag and drop palette files onto color pickin chooser to suck out all their colors.

Retain original GIMP palette and color names, even comments.

color pickin chooser doubles as a capable palette converter.

Full group comments support..

Color group and Gimp palette comments are retained during all import and export functions.

Attach comments and notes to your color groups, view and edit them, all from within color pickin chooser.

All controls are live..

Everything dynamically updates everything else!

Live hex tool tips and title bar..

Copy and auto-copy hex color values to the clipboard..

Rapid color picking in multiple output formats..

Web RGB
Autoit RGB
Autoit BGR
Visual C++
Delphi
RGB Integer
RGB Float
HSL (Hue/Saturation/Lightness)
CMYK (also available "normalized" to percentages)

With or without prefixes, as required.

Handy hotkeys (and SHIFT-click duplex operation!)


Click the tray icon to show and hide the chooser..

color pickin chooser will never clutter up your taskbar!

Incorporates access to the Windows system color chooser

..if you really must!
 

oodles of hidden tricks and features..

Plus a handy tips system so you can discover them!

And Much, MUCH more!

 

Itstory - the how-what-why and when
mainly for developers, but highlights some tricks and tips, too..

The first improvement over the regular system chooser is the color picker itself. As well as a standard Windoze type color picker, you can load any old image into there, and a few samples are provided. You can throw more images into the picker images folder manually, or simply drag and drop images into the chooser itself. Sub-folders inside the pickers folder will be grouped that way in the context menu.

You can also select an existing folder of images, and use those as your color pickers. There's a context menu on the picker image itself. Right- click there for all the fun.

I still wanted to keep things simple, maybe even simpler, but there were a couple of features I couldn't do without, and a few new things I wanted badly, in my own color picker..

One thing that annoys me about using the Windoze color picker in my apps is that I can't get it to remember custom colours. And what I really want is groups of custom colours. So now we have all that. It's all so simple I won't go into details. Of course, all your color groups are remembered.

You can also import colours from other ini files. Simply drag and drop any old ini file onto the color groups input, and the color pickin chooser will scan it for color preferences, converting any it finds into valid color groups. It will even retain the original section names, so you could chuck on, for instance, your schemes.ini (from corz clock), and VOILA! you have a handful of new color groups along the lines of "green meanie", and "the blues". Select one of the new groups, and all the colors for that clock will appear, along with their correct names. Pretty neat.

And for that killer function finale, you can also drag entire folders onto the color groups combo, and the color pickin chooser will scan the entire folder for ini files and load any color it finds anywhere into a cpc color group. Beware, if you drop your root folder into the color pickin chooser, it may take a moment or two. In reality, this functionality is more for storing and sharing schemes than it is for plucking schemes out of thin air, though it does that rather well, and my own program files folder threw up a few interesting schemes. I also had to delete heaps (which is a trivial matter, thanks to the 500 item combobox history).

You can also drag images into the picker image and have them imported into your picker images folder and set as the current images. A new folder called "Imported" is created inside your picker images folder; a way to keep imported images together in the context menu, and a place to keep them until you organise them better; if that's your bag.

Actually, you can drag and drop images or inis or folders onto either the groups control OR the main image; everything being worked out internally. I aim for looseness of intent in all human-program interactions.

If you right-click any of the group controls, you can access the color group menu, which includes the export features. You can export your colors as either color pickin chooser group (ini) files, JASC compatible color palettes (ready to use in any jasc palette-capable application; Paint Shop Pro, MicroAngelo, MMJ, or whatever), and Gimp palettes, which are simply the best palette format out there.

Another thing I couldn't do without was the luminance bar. I personally like to select a primary color and then create a family of colours by choosing different luminance levels, basically lighter and darker versions of the same color - handy for making schemes, for all sorts of things. I also wanted it better than the system version, smoother. This was a nice wee challenge.

The math for calculating luminance from RGB levels is nasty, and the thought of hundreds of calculations on every update - yikes! However, I devised a much simpler and quicker way to do it. All a luminance bar is, basically, is a gradient from white to black, passing through the selected colour. So, instead of all the repetitive math, we need to simply draw two gradients, one from the colour to black, and the other from the color to white. TADA! Shift-Click that baby for big fun. It can also be "live" (F5).

Initially I was using the AutoIt drawing functions to draw the gradient, but as well as refreshing the whole GUI with every update (the flashing knobs!) it would cause everything to slow down, exponentially. Within a minute of using the chooser, the magnifier was completely unusable, for instance. Oh yeah, there's a the magnifier, too. I'll get back to that.

So I tried using labels for the gradient. That's what the magnifier uses, you see, and drew one hundred and fifty labels, each a single pixel high. They update instantaneously. *sigh*

The magnifier is pure AutoIt, No DLL calls. Basically CodeMaster Rapture's work, with some minor changes, and slotted into the gui perfectly. Cheers! I did begin with a dll call type thing, and had it slotted in the gui, but had to switch it out when mouse clicks on it wouldn't register (and you gotta be be able to choose from the mag, right?). But now that the slow-SLOW gradient drawing is gone, everything is pretty fast.

I think it's the funkiest color chooser on planet earth, but then, I would. It does what it does and does it pretty well. It's also free, and AutoIt source and all extras are included, so have fun!

 

Foibles..

When keying in colors manually (via decimal RGB values, or hex), you need to activate an input for the change to take effect. Tabbing to the next input, clicking anywhere, and hitting enter, are all ways to activate an input.

The color wells are stored in no particular order, so when you add a color by clicking an empty color well it is tagged on the end, even if that wasn't the well you clicked. I should mention; clicking empty color wells is the slowest way to add colors. (shift-pick, or use F2/Enter)

The first click on mag after super-mag doesn't set the color (it activates the window). so either activate the window some other way, or else double-click the mag.

Everything else is a feature!

 

Usage..

As a stand-alone application:

Compile and run, or easier still, grab the .exe. En-joy!

If you are compiling yourself, remember to include the icons (in the zip) or else your tool buttons won't be painted. As far as I know, only AutoIt3Wrapper can put extra icons inside compiled exe files.

For everything to work as expected, you must keep the icon order exactly as is in my compile directives..
	#AutoIt3Wrapper_Res_Icon_Add = img\icons\grad.ico
	#AutoIt3Wrapper_Res_Icon_Add = img\icons\mag.ico
	#AutoIt3Wrapper_Res_Icon_Add = img\icons\hex.ico

Replacing the file paths with wherever you keep them, of course.

You'll also need to remove or replace the FileInstall commands (sample images and tips) with your own paths, or else you will get compile errors. You'll need my "corz_" includes in your includes folder, too. Or else specify alternative paths to them. I think that's about it.

The exe is clean, if you want to save yourself some work.

As an include:

For use in your own applications, see above notes, but remember to instead include the icons in your MASTER APPLICATION'S compile directives. I've coded cpc so you can work on it as an stand-alone application or an include without any editing or fiddling around, once it's got the right paths setup, that is. Then..

In your master application, include the color pickin chooser..
	#include <color pickin chooser.au3>
Then, whenever you need a color, call the function ..
	$new_color = ColorPickinChooser()
When you close the color pickin chooser (by clicking "done!"), the picked color will be in $new_color. If the user closes color pickin chooser with the "x" button, the return value is as if no color was picked (see 'return value', below).

 

IMPORTANT:

If you are compiling this yourself, you need to use "AutoIt Wrapper" to add the extra icons. You will also need to use AT LEAST version 1.9.3 of AutoIt Wrapper for the paths to work correctly. You can download it here.

 

Input parameters..

When calling the color picking chooser, you can specify a few things, namely; the color to select, the group to select, whether or not to return an AutoIt value, and the name of a function you want run periodically. All parameters are optional..

ColorPickinChooser([$set_color[, $scheme[, $autoit_val[, $func]]]])


$set_color {string}

(defaults to last picked color - saved in cpc ini)

Set the initial colour to this. 6-digit RGB Hex value. you can also send an AutoIt RGB value, if you really must.

You can send an empty string "" to set the default color.

$scheme {string}

(defaults to last selected color group - saved in cpc ini)

Name of color group to load into the color wells.

If your application has color schemes, send the name of the scheme to the color pickin chooser, and if it has a color group of that name (hint: you made one - probably by dragging an ini file into the chooser), it will load that group automatically. Nize.

Tip: import clock's schemes.ini file for a bunch of ready-made color groups that happen to exactly match your clock color schemes! They will also have all the scheme's colors, with the correct names, for face, hour hand, etc, even comments. Did I hear "Handy"?

You can use an empty string "" to set the default scheme.

$autoit_val {boolean}

(true.. '0xFFFFFF', false.. 'FFFFFF', defaults to false)

Rather than return a web hex value, return an AutoIt color.

You can also use "" to set the default.

$func {string}

(defaults to an empty string, and performs no function)

The name of a functions you would like to perform periodically

If your application has any time-dependant activities, you can send the name of a function you would like called. The function will be called on every loop, around ten times a second.

corz clock uses this facility to keep itself updated, and give the vague appearance of multi-threading.
 

Return value: An RGB hex color value, e.g. #FF9900

If no color was picked (nothing changed) cpc returns the original color that was sent ($set_color).

If no color was sent by the calling application, and no color was picked, cpc returns an empty string.

NOTE: If you need the color in a different format, check out ConvertColorValue(), in <corz_colors.au3>
 

Usage examples:

Simple usage:

	$color = ColorPickinChooser()
The color pickin chooser will remember the last picked color, last selected color group, even the last magnified region, so the simple usage is perfectly acceptable; color pickin chooser can take care of the details.

Specifying only an AutoIt return value:

	$color = ColorPickinChooser("", "", true)

Specifying color and color group values, returning an AutoIt value:

	$color = ColorPickinChooser("FFFFFF", "basic colors", true)

Specifying only a function to call:

	$color = ColorPickinChooser("", "", "", "MyFunction")
etc.
 

Download corz color pickin chooser

color pickin chooser is free to download, and free to use (though all donations warmly accepted! ;o). Click here to download a zip of the Windows application. Simply unzip and drop it somewhere, probably inside your program files folder. To uninstall, simply delete it.

If you want to customize the color pickin chooser, or use it in your own applications, click here to download the AutoIt source pack, including all supporting files, icons, includes, source code and goodies, so you can compile it yourself. Have fun! If you have any issues, leave a comment, below.

Of course, you'll need to have AutoIt installed if you want to make use of the source pack.

If you want to just look at the source code, see here.

 

License:

corz color pickin chooser is FREE for personal use. For commercial or continued use, why not PayPal me a fiver.

No warranty is expressed or implied, etc.
 

2do (delete when done & add feature note!)..

 

bugs (delete when fixed!)..

Vista: The magnifier incompatible with the Aero theme drawing routines. To use the color picking chooser in Vista, you will need to use a "classic" or "standard" theme. This is why.. GetPixel(). I may look into alternative strategies.

 
cbparser powered comments..

lolipopman - 04.10.07 10:04 pm

Hi, it doesn't work in Windows Vista, i just get the error message:

Line -1:
Error: Subscript used with non-Array variable


cor - 05.10.07 8:28 am

Hmm. I have no Vista to check.
Do you fancy trying out the source and seeing what's up?

;o)
(or

ps. I made a couple of small fixes today, all online files updated. perhaps this has fixed your error, too, though without Vista, I dunno… smiley for :erm:


cor - 18.10.07 8:26 am

By the way, it's working fine in Vista, I guess I should have commented about this. There is an issue with the mag when using Vista's Aero schemes, but it's a bug with Aero, so there's not a lot I can do about it, for now.

Everything works fine if you use a "classic" scheme.

;o)
(or


SunnyJ - 07.03.08 4:08 pm

I thought I was looking at WEEKS to convert all my palettes from PaintShop Pro to the Gimp. After some googling I found this thing! THANK YOU! Job done in minutes!! lol

Cheers!


cor - 08.03.08 12:03 am

Hey! I like that, SunnyJ! A great quote for the brochure, if there was a brochure.

The help system might seem like an annoying thing, but it's definitely worth running through all the tips, at least once; converting palettes is one of many wee tricks up the color pickin chooser's sleeve.

Glad to be of service.

;o)
(or


Mojo - 02.04.08 3:08 pm

Hey Corz,

I just wanted to say THANK YOU VERY MUCH for this great script. I just downloaded it and haven't tested it yet, but from what I see here on the website, it's absolutely GREAT!

I wanted to do something similar but would have NEVER EVER came to the many ideas that you implemented here! smiley for :roll:

Also the whole website here is awesome. Explaining every detail of the script etc - I just love it!^^
I think I'll have to do this for my own scripts aswell smiley for :D

And a special thank for keeping it open source - really appreciated ;-) !!

greetz
Mojo (@ AutoIt Forum)


cor - 03.04.08 11:38 am

Thanks, Mojo!

For sure, there can never be enough good documentation. For me, producing notes and comments is almost as important as the coding. I make a point of coding "as if" I were going to release it, even if I never plan to! But of course, in this case, I did.

It's not purely for users; often I'm away from coding for months at a time, and the notes help ME understand things, too!

Anyway, I figured it was about time someone created a decent color chooser for AutoIt, and you're free to use and re-use the code as much as you want. There's more AutoIt source on-site, too. Rake around!

;o)
(or

ps. that reminds me, I must drop into the AutoIt forum sometime - good bunch of lads.


SEMSEM - 08.08.08 11:04 pm

LET US GO


 

leave a comment, become part of this site!


First, confirm that you are human by entering the code you see..

(if you find it difficult to read, refresh the page for a new code)


Enter the 5-digit code this text sounds like : lower-case ex, Upper-Case Ay, foor, lower-case aye, Upper-Case Dbl-U


 
 
[site notice]

If you give a shit, BUY A SHIRT!