|[ Up (Contents) ]||Page Last Updated: 13 April 1998|
This appendix explains the meaning and use of color names. Color names are text strings, such as white, blue, or fuchsia, that can be used--instead of the far less obvious hexadecimal RGB color codes--to specify the color for the text, window background, or background of a table cell. These names are divided into two categories: basic color names, defined as part of the HTML specification, and extended color names, which are not defined in the standard. Tables F.1 and F.2 list these colors alongside their RGB code equivalents. HTML documents that illustrate these colors are found on the supporting Web site, at URLs listed later. Most modern browsers (e.g., Navigator 3 and Internet Explorer 3 or later) support both sets of names. The appendix concludes with a brief description of the Microsoft Windows color palette, and its relationship to these named colors.
Note that these named colors can be used equally with HTML color assignment attributes (e.g., BGCOLOR) and cascading stylesheet declarations. Note also that all named colors are defined in terms of hexadecimal RGB color codes. We thus begin with a review of RGB color code specifications.
Hexadecimal Color Codes
In HTML (and also in CSS), colors are expressed as RGB codes, of the forms #RRGGBB or #RGB. In the form #RRGGBB, the strings RR, GG, and BB are the hexadecimal values of the red, green, and blue color intensity, in the range 0 (off) to FF (as bright as possible, equal to decimal 255). In the form #RGB, the single letters R, G, and B correspond to hexadecimal numbers in the range 0F: The actual color intensities for the red, green, and blue are calculated by repeating these single hexadecimal digits. Thus, the color code #5F3 is converted into the full RGB color value #55FF33. In either case, many browsers will let you omit the hash (#) at the beginning of the color code, but it is safest to include this character, since it is then easy to search through the file for hashes, and find all the color codes.
You should note that the same color code will often produce slightly different colors on different computers, due to the differing qualities and properties of the displays. These problems are technical, and are due to the limited ability, on most personal computers, to compensate in software for the peculiarities of a particular monitor or graphics card. These problems should be solved in the next few years.
Basic Color Names
Table F.1 lists the 16 basic color names, alongside the equivalent RGB values. These colors are defined in the default Microsoft Windows colormap, and are consequently never dithered by 8-bit (256-color) Microsoft Windows systems. A document illustrating these color names can be retrieved from this Web site, at:
The Sixteen Universal Color Names and Corresponding RGB Hex Codes -- color1.html
Extended Color Names
In addition to the 16 basic color names, Most browsers support an additional 124 values, taken largely from the UNIX X-Windows system default color palette--Table F.2 lists these names alongside the equivalent RGB codes. Note that most of these colors are not defined in the Microsoft Windows colormap, so that they are often dithered or otherwise replaced on 8-bit color displays.
Of course, having a name or RGB code is not terribly helpful, as neither gives a sense of what the color looks like. To help you in this regard, the supporting Web site contains a document that illustrates the colors in the extended color palette. This document is found at:
The 124 Colors of the Extended Color Names, and Corresponding RGB Hex Codes -- color2.html
Handling of Unknown Color Names
If an HTML color attribute (or a CSS color declaration) calls for a named color that is unknown to the browser displaying the document, the browser will assume that the string is an RGB color code, and will attempt to decode the string as red, green, and blue hex values. This can lead to extremely bizarre and unpredictable colors!
The Windows Colormap
The default Microsoft Windows colormap consists of the 16 colors defined in Table F.1, plus 216 additional colors defined by equally sampling each of the primary colors (red, green, and blue) in the interval 0 to 255, and mixing these colors together in all possible combinations. The "equal sampling" is accomplished by taking primary color intensities with values of:
Decimal 0 51 102 153 204 255 (multiples of decimal 51) Hex 0 33 66 99 CC FF (multiples of hex 33)
These are simply the six numbers equally spaced between 0 and 255 (or 00 and FF). The total number of colors (216) is just the total numbers of ways these colors can be mixed: 6 (red) ´ 6 (green) ´ 6 (blue) =216.
There are no special names associated with the colors of the Windows colormap, other than for the 16 universal colors listed in Table F.1. However, because these colors are never dithered on Microsoft Windows systems with 8-bit color displays, this set is an ideal palette choice when creating Web graphics. In many graphics editing programs, this palette can be selected by choosing the "Windows colormap" as the default palette selection.
|The HTML 4.0 Sourcebook||© 1995-1998 by Ian S. Graham|