RGB Colors

Playing with RGB Values

In the body statement colors must be specified in hex RGB format. This is not the easiest thing to understand. First of all RGB stands for Red Green Blue and and RGB value describes the mix of reb, green, and blue it takes to get that hue. For example, red + blue = magneta, green + blue = cyan, and red + green = yellow. The red, green, blue values go from 0 to 255 decimal (what humans use) and 0 to FF hex.

Hexadecimal Values and Conversion

A hexadecimal number is base 16, which means it goes from 0 to 15, or, since you can't type a 15 with one key on a keyboard, from 0 to F. Thus 10 = A, 11 = B, 12 = C, 13 = D, 14 = E, 15 = F. Since we're only dealing from 0 to 255 here, 0 would be 00, 10 would be 0A, and 255 would be FF.

If you want to convert from decimal to hexadecimal, your best bet is a calculator that does it for you. But let's say you don't have one. Obviously, if the number you want to convert is between 0-15, you just take the 00-0A value. If it's over 15, what you will have to do is divide the number by 16, then take the fractional remainder and multiply by 16. This will give you the first and second numbers of the pair. For example take 142. Divide it by 16 you get 8.875. Thus the number to the left of the decimal is your first hex number. Now take 0.875 and multiply it by 16. You get 14, which is E in hex, and this is your second number. So 142 in decimal is 8E in hex.

Finding Likable Colors on a PC

Bring up the desktop color chooser: Right click on the Desktop, select Properties. Click the Desktop tab. In the lower right, click on the Color rectangle, then choose Other. A rainbow of colors can be chosen, and in the lower right Red, Green, and Blue values are displayed. Once you find a color you like, simple convert the decimal RGB to hex.

Example you have red at 153, green at 115, and blue at 0:
Red: 153 converted to hex is 99.
Green: 115 converted to hex is 73.
Blue: 0 converted to hex is 00.
The hex triplet for the body is now: #997300.

Finding Likable Colors on a Unix Workstation

To get direct hex values from your colormap you can run xcmap. Note: only use the first two values of each hex value.
You can try them out with: xsetroot -solid #43AAE3
And you can see a list of decimal rgb values (which you can then convert to hex) look at the file /usr/lib/X11/rgb.txt.

Or to drive yourself insane, try looping through the color list:

unix prompt> foreach P ( `cut -c13- /usr/lib/X11/rgb.txt` )
foreach? xsetroot -solid $P
foreach? echo $P
foreach? sleep 1
foreach? end
;

Finding Likable Colors on the Web

A site which allows you to choose values and see the colors is RGB to Hex.