The University of Texas at Austin- What Starts Here Changes the World
Services Navigation

Generating Colors in HTML


The color samples in the tables below are not images; they are generated by the HTML of this page.

Colors can be produced for a number of page elements using the color names or RGB hexadecimal codes indicated in each of the samples.The use of HTML elements and attributes for specifying color is deprecated. You are encouraged to use css instead.

Of interest to UT Web authors/designers: the Brand Identity Primary Colors shows #CC5500 as offical "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!). In the future, support for the sRGB (Standard Default color Space for the Internet) and ICC color profiles should reduce this problem.

Named Colors

These 16 colors can be specified by name in HTML 4. The color names are case sensitive. So, for example, you could use either "#000000" or "Black" to refer to the color black.

Color                
Name Aqua Black Blue Fuchsia Gray Green Lime Maroon
RGB #00FFFF #000000 #0000FF #FF00FF #808080 #008000 #00FF00 #800000

 

Color                
Name Navy Olive Purple Red Silver Teal White Yellow
RGB #000080 #808000 #800080 #FF0000 #C0C0C0 #008080 #FFFFFF #FFFF00

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 to FF. 00 represent the least amount of the color present and FF represents the most of that color present. The first two bytes indicate the amount of red, the second two bytes represent the amount of green and the last two bytes represent the amount of blue.

Hex Value
Red Green Blue
00 00 00

Here are some simple examples:

  • Red = #FF0000
  • Green = #00FF00
  • Blue = #0000FF
  • Cyan (blue and green) = #00FFFF
  • Magenta (red and blue) = #FF00FF
  • Yellow (red and green) = #FFFF00

The number of possible colors represented by this system is 256 * 256 * 256 = 16.777,216

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 Red

FF3300 Red(Orange)

ff6600 ff9900 FFCC00 Gold FFFF00 Yellow
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 Black 003300 006600 009900 00cc00 00FF00 Lime
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 Aqua
00 33 66 99 cc ff
where green=

Hexadecimal Gray Scale
000000 Black 333333 666666 999999 cccccc ffffff White

HTML Attributes to Specify Color

If one of the following <BODY> attributes is 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.


  Updated 2012 April 17
  Comments to TeamWeb