# Specifying color by RGB values Web Designing

The most common and precise way to specify a color in HTML is by its numerical RGB (red, green, blue) values. For an explanation of RGBcolor.

Once you've identified the red, green, and blue values of your chosen color (an image editing tool helps with this task), you need to translate them to their hexadecimal equivalents in order to enter them into the HTML color tag. These values are written in HTML with the following syntax:

"#RRGGBB"

RR stands for the hexadecimal red value, GG stands for the hexadecimal green value, and BB stands for the hexadecimal blue value. Using these values, you can specify any color from the "true color" space (millions of colors).

Let's look at an example to put this in context. To set the background color of a document to dark olive green, first find the RGB values of the color (85, 107, 47) and convert them into their hexadecimal equivalents (55, 6B, 2F; explanation of conversion follows). Then the values can be placed in an HTML tag, in this case to change the background color of a page:

<BODY BGCOLOR="#556B2F">

The hexadecimal numbering system is base-16 (as compared to base-10 for decimal numbers). It uses the following 16 characters:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

A through F represent the decimal values 10 through 15.

You can calculate hex values in the 0 to 255 range by dividing a number by 16 to get the first digit, then using the remainder for the second digit. For example, dividing the decimal number 203 by 16 yields 12 with a remainder of 11. The hexadecimal value of 12 is C; the hex value of 11 is B. Therefore, the hexadecimal equivalent of 203 is CB.

Fortunately, there are simpler methods for converting numbers tohexadecimal:

• Use Table, which translates decimal values from 0 to 255.
• Use a hexadecimal calculator. On the Macintosh, you can download a copy of a utility called Calculator II. Windows users can find ahexadecimal calculator in the "Scientific" view of the Windowsstandard calculator.
• Use online resources. There are several resources online forcalculating hexadecimal equivalents. Some allow you to enter all three values for red, green, and blue, and convert to hexadecimal whilshowing you a sample of your chosen color immediately. Examples of online calculations include:

Mediarama's Color Page Builder
Plug in your decimal RGB values for page elements, and this pageautomatically generates a sample page with your color selections and the HTML code for the <body> tag.

URL Univox Internet: RGB 2 Hex
This is a stripped-down, no-frills tool for converting decimal RGB values to their hex equivalents.

.

Hexadecimal Values for Web Palette Colors
The web palette is a set of 216 colors that will not shift or dither when rendered in browsers on 8-bit monitors (for a thorough explanation of the web palette. All colors in the web palette are made up of combinations of the following six hexadecimal values: 00, 33, 66, 99, CC, and FF.