Programmer's Color Picker
What Is This?
The Programmer's Color Picker is a utility for choosing
colors and converting them to and from different color formats.
Certain programs and APIs require color data using different
color models and in different numeric formats; most commonly,
RGB and HSV values in decimal (0-255) and floating-point (0.0-1.0).
Future versions may expand the number of models and formats supported.
How to Use It
There are several ways to use this program. The easiest way is
to click on the Pick... button and choose a color with the standard
Windows color picker. Another way is to click on the Grab... button, take
a screenshot, and "grab" a color from any program or image being displayed on the screen.
A third way is to type in the color data manually
into the different boxes and click the "Translate" button in the box
you wish to translate from. (This method is usually only useful for
conversion purposes when certain color values are already known.)
Note that typing in color data yourself can in many cases lead to
"illegal" (out of range) values unless you happen to get them
from a source that only gives legal values; look in the
Color Models section for more information on the
values expected by each color model. It is particularly easy to
provide illegal values to the CMYK and YIQ color models; if CMYK
or YIQ colors are needed, it may be best to convert from a safer or
more intuitive color model.
The Grab Screen button (under the Grab... menu) will hide all currently opened ColorPicker windows,
attempt to make sure the desktop and its windows are redrawn, and then capture the screen.
It is usually unnecessary to move ColorPicker out of the way before capturing
the screen, but there can be cases where the screen doesn't redraw fast enough. Another thing to note is that
the two color boxes in the lower-left corner of the Screen Capture menu serve two different functions: The one on the
left contains the currently selected color (this is copied into the RGB area of the main form when Ok is clicked), the one on the right
contains the color currently under the cursor when it is over the screen capture window.
The "Inner" and "Outer" colors can be used to contrast two or more colors.
You can also save up to 16 more colors by using the Windows color picker's
"Custom Colors" feature.
Color Models
- RGB The most "popular" color model, color is represented
using Red, Green, and Blue values. When all three
elements are zero, you get black; when all three elements are at their
maximum (255 or 1.0 as the case may be), you get white. RGB is an
additive color model since increasing the values increases the
luminosity of the blended color.
Note: The Pick... button has been placed in the area for RGB values
since Windows returns RGB values from its color picker; however, the
Windows color picker itself is based on HSV colors (see the
section on HSV below).
- HSV A more natural color model, color is represented
using Hue, Saturation, and Value elements. ("Value" is also known as "brightness" or "luminosity.")
Hue is difficult to set manually; suffice it to say that it's
based on a 360-degree wheel with red, green, and blue at 120-degree
angles to each other. Saturation tells how intense a particular color
is. If Saturation is low, a particular color will tend towards greyness,
while if Saturation is high, the color will tend to be purer.
Value sets the brightness of the color. Two important things to note are that
Hue is not defined for all colors; if the color picker selects a color where
the Hue cannot be represented, it will put -1.0 in the box for Hue.
Another thing to notice is that because Hue represents the "color wheel", it is
always in the range of 0-360, no matter what the current number
format is (decimal or floating-point).
Note: The standard Windows color picker is based on HSV colors. The
horizontal axis of the main color selection area represents hue, the vertical
axis represents saturation, and the vertical bar on the right represents
luminosity. However, the Windows picker uses a number range of 0-240 to
represent each of the elements, so the numbers it gives are not directly translatable
to the ColorPicker program (which uses different number systems).
- CMY & CMYK As opposed to RGB, CMY and CMYK are a subtractive
color model based on Cyan (green-blue), Magenta (red-blue),
and Yellow (red-green). Mostly used for printing purposes, CMY is more
of a theoretical model since, in real life, it is difficult to get a perfect
black out of printing inks or toner just by mixing equal parts of cyan, magenta and yellow.
CMYK uses a Black element (abbreviated K) that makes up for this problem.
Note: While a legal CMY color exists for all values of CMY in the range of the current
number format, the same is not true for CMYK. Setting CMYK values manually is not recommended.
- HTML Color The hexadecimal RGB triplets popularized by HTML. This number consists
of a pound sign (#) followed by three 2-character hexadecimal numbers (from 00-FF) specifying an RGB triplet.
If you're proficient in hexadecimal, feel free to type in numbers manually, but one thing to be careful of when converting
from HTML color is that each of the 2-character RGB elements need to be 2 characters, even if they're zero
or below 16. (Otherwise strings like "#00104" could be interpreted in several different ways.) The pound sign is optional
when converting from HTML color, but ColorPicker will give an error if it doesn't find the necessary number of characters.
- YIQ Sources tell me this format was invented by the TV industry to make
color TV signals backward-compatible with black-and-white signals. In any case, this
format is mainly useful because the Y value gives the apparent visual luminosity of
the current color. (In other words, it takes into consideration that green is more
visually "exciting" than red, and red more so than blue.)
Note: Because the conversion between RGB and YIQ requires matrix transformations
that make it a completely unintuitive color model, it is very easy to produce out-of-range RGB values by typing in YIQ values manually.
It is not recommended. (Though increasing or decreasing the Y value is handy!)
- YUV YUV is the European-television equivalent of YIQ. Variations of YUV encoding are used by various algorithms, including JPG image compression.
The "Y" values in YIQ and YUV are always identical.
Note: Similarly to YIQ, it is difficult to invent legal RGB colors by typing in YUV values "by hand," but the Y
element has the same useful properties as the Y element in YIQ colors.
Website
My website is located at http://www.geocities.com/~ffrog.
I welcome queries, job offers, threats, etc. I didn't spend too much time on this documentation,
so you may be curious about how some of these color models work...
- Sean O'Malley
- E-mail
- August 8, 2000