Thursday, April 29, 2010
The human eye recognizes color using three kinds of photoreceptor cone cells, each sensing a different band of light — Red, Green, and Blue (abbreviated as "RGB"). These are called the three "basic" colors.
This is different than "primary" colors, which are red, blue, and yellow.
Printer ink on magazines use a color model called "CMYK" for the Cyan, Magenta, Yellow, and blacK pigments that are blended to absorb light reflecting off the media. This is called "subtractive" Image Mode in Photoshop.
Black is the absence of light shining, so it's specified with zeros.
White () light contains the maximum value of all three colors.
"Normal" gray () has equal amounts of all three primary colors at 50%, represented as decimal 128 or hex 80.
Each 8-bit hex digit can have one of 16 values (from 0 through 9,A,B,C,D,E,F). So divide a decimal number by 16 for the first hex digit. Divide the remainder by 16 for the second hex digit.
Alternately, multiply the first hex digit by 255 to convert it to decimal.
RGB coloring is specified in Cascading Style Sheet coding one of several ways:
color: rgb(255,255,255); // 3 decimals
color: #FFFFFF; // hex triplet
color: #FFF; // hex shortcut
3-digit hex shortcuts are automatically converted by browsers doubling each digit such that #678 = #667788. Although more compact, they cannot be used to identify colors with non-repeating color values such as #ACD257.
Since the maximum value of each hex "FF" is equivalent to decimal value 256, the RGB color space has 256*256*256 or 16,777,216 possible colors, while most humans can distinguish a gamut of about 10 million different colors.