RGB and Hexadecimal
RGB color describes a color as a combination of red, green, and blue light. The standard representation for RGB color is a series of 3 8-bit numbers; that is three numbers between 0 and 255. (This is not the only representation, -- since 255 is awkward to do math with, sometimes colors are represented as three floating-point numbers, so each color is in the range of 0.0 to 1.0. If you know about floating-point numbers, though, you'll know that this representation requires four times as much space).
A common way of representing numbers on a computer is hexadecimal. Like
the name implies, hexadecimal has 16 digits: 0 through 9, and then a, b, c,
d, e, f. a is equivalent to the decimal number 10.
The hexadecimal 10
is equivalent to the decimal number 16. The hexadecimal number
equivalent to the decimal number 255, so the entire range of 8-bit numbers
can be expressed in hexadecimal as
0x prefix is a common
designator of hexadecimal). When designating RGB colors, the red, green, and
blue channels are often concatenated to form one hexadecimal number. For
0x000000 is black,
0xff0000 is red,
0xffffff is white.
<body bgcolor=... tag takes as an argument a hexadecimal
representation of the color you want to use. Picking a color in RGB
isn't exactly intuitive. It's usually best to browse using an HSV color-picker
like the java applet below:
You can use any color picker though, as long as you know how to convert from what the color picker displays (usually 0-255) to what HTML wants as a tag (0x00-0xff). This is simply a matter of converting from base-10 (decimal) to base-16 (hexadecimal):
|Comments?||Last modified: Thu Jun 20 12:30:29 1996|