Generating Colors in HTML

The color samples in the tables below are not images; they are generated by the HTML of this page. Netscape 3.0 (or higher) or Internet Explorer 2.0 (or higher) are required in order to view the samples.

Colors can be produced for a number of page elements using the color names or RGB hexadecimal codes indicated in each of the samples.

For comparison, the background of this page is #cccccc.

Of interest to UT Web authors/designers: the Pantone Internet Color System Guide (ISBN 1-881509-94-X) shows #cc6600 as closest to "UT burnt orange." It may not appear so on your screen; the wide disparity in color calibration among computer monitors makes it difficult to predict how accurately color will be rendered across the Web. It is best simply to specify the appropriate color and not worry too much how the result will appear on a given monitor (including your own!).


Named Colors
These 16 colors can be specified by name; they were chosen for the HTML 3.2 recommendation because they are the standard colors supported in the Windows VGA palette.

aqua black blue fuchsia green gray
lime maroon navy olive purple red
  silver teal white yellow  


RGB Hexadecimal Coded Colors
Colors may also be specified by six-character codes representing their relative red/green/blue (RGB) values, where the possible values for each color component are 00, 33, 66, 99, cc, and ff.

The six charts below display the 216 possible colors in the Netscape/MSIE palette with their hexadecimal RGB codes (a seventh chart displays the gray scale). In each chart the blue value is constant, the vertical axis represents increasing red values, and the horizontal axis represents increasing green values.

The six charts can be visualized as a cube composed of 216 cubelets; the total cube has six layers of thirty-six cubelets; each cubelet is a unique color. Using this metaphor, black (#000000) in the lower left of the first chart is one corner of the cube and white (#ffffff) in the upper right of the last chart is the opposite corner of the cube; the cubelets running through the body of the cube in a line from black to white comprise the gray scale.

1 of 6 where blue=00
where red= ff ff0000 ff3300 ff6600 ff9900 ffcc00 ffff00
cc cc0000 cc3300 cc6600 cc9900 cccc00 ccff00
99 990000 993300 996600 999900 99cc00 99ff00
66 660000 663300 666600 669900 66cc00 66ff00
33 330000 333300 336600 339900 33cc00 33ff00
00 000000 003300 006600 009900 00cc00 00ff00
00 33 66 99 cc ff
where green=

2 of 6 where blue=33
where red= ff ff0033 ff3333 ff6633 ff9933 ffcc33 ffff33
cc cc0033 cc3333 cc6633 cc9933 cccc33 ccff33
99 990033 993333 996633 999933 99cc33 99ff33
66 660033 663333 666633 669933 66cc33 66ff33
33 330033 333333 336633 339933 33cc33 33ff33
00 000033 003333 006633 009933 00cc33 00ff33
00 33 66 99 cc ff
where green=

3 of 6 where blue=66
where red= ff ff0066 ff3366 ff6666 ff9966 ffcc66 ffff66
cc cc0066 cc3366 cc6666 cc9966 cccc66 ccff66
99 990066 993366 996666 999966 99cc66 99ff66
66 660066 663366 666666 669966 66cc66 66ff66
33 330066 333366 336666 339966 33cc66 33ff66
00 000066 003366 006666 009966 00cc66 00ff66
00 33 66 99 cc ff
where green=

4 of 6 where blue=99
where red= ff ff0099 ff3399 ff6699 ff9999 ffcc99 ffff99
cc cc0099 cc3399 cc6699 cc9999 cccc99 ccff99
99 990099 993399 996699 999999 99cc99 99ff99
66 660099 663399 666699 669999 66cc99 66ff99
33 330099 333399 336699 339999 33cc99 33ff99
00 000099 003399 006699 009999 00cc99 00ff99
00 33 66 99 cc ff
where green=

5 of 6 where blue=cc
where red= ff ff00cc ff33cc ff66cc ff99cc ffcccc ffffcc
cc cc00cc cc33cc cc66cc cc99cc cccccc ccffcc
99 9900cc 9933cc 9966cc 9999cc 99cccc 99ffcc
66 6600cc 6633cc 6666cc 6699cc 66cccc 66ffcc
33 3300cc 3333cc 3366cc 3399cc 33cccc 33ffcc
00 0000cc 0033cc 0066cc 0099cc 00cccc 00ffcc
00 33 66 99 cc ff
where green=

6 of 6 where blue=ff
where red= ff ff00ff ff33ff ff66ff ff99ff ffccff ffffff
cc cc00ff cc33ff cc66ff cc99ff ccccff ccffff
99 9900ff 9933ff 9966ff 9999ff 99ccff 99ffff
66 6600ff 6633ff 6666ff 6699ff 66ccff 66ffff
33 3300ff 3333ff 3366ff 3399ff 33ccff 33ffff
00 0000ff 0033ff 0066ff 0099ff 00ccff 00ffff
00 33 66 99 cc ff
where green=

Hexadecimal Gray Scale
000000 333333 666666 999999 cccccc ffffff


HTML Attributes to Specify Color

If one of the following <BODY> attributes are used, they all should be specified in order to avoid color conflicts; for example, you may assign a backgound color and a visitor may have his/her browser set to display text in the same color, making your page unreadable. All these attributes should be specified in a single <BODY> tag.

<BODY BGCOLOR="#ff6600">
sets the background color for the page as a whole.
<BODY TEXT="#ff6600">
sets the text color for the page as a whole.
<BODY LINK="#ff6600">
sets the unvisited link color for the page as a whole.
<BODY VLINK="#ff6600">
sets the visited link color for the page as a whole.
<BODY ALINK="#ff6600">
sets the activated link color (i.e. the color of the link as users click on it) for the page as a whole.

<FONT COLOR="#cc6600">sample text</FONT>
sets the color of selected text within a page.

Although the following attributes are not included in the HTML 3.2 specification for <TABLE>, <TH>, and <TD> elements, they are included in the HTML 4.0 proposal and have been supported by Netscape since version 3.0 and by Internet Explorer since version 2.0.

<TABLE BGCOLOR="#ff6600">
sets the background color for an entire table.
<TH BGCOLOR="#ff6600">
sets the background color for one header cell within a table.
<TD BGCOLOR="#ff6600">
sets the background color for one data cell within a table.


Maintained by Keith Baird
Learning Web:   Q & A | Classes | Use | Publish | Administer
16 December 97
TeamWeb at UT Austin
Comments to: