HTML Color

Overview

HTML tags allow you many methods of incorporating color into your web document. You can set the main colors of the page using the <body> tag, you can alter the color of text with the <font> tag and you have control of table's cells and rows' colors as well.

There are two methods of determining color in an HTML tag. One is by placing color value code within the tag and the other is to assign a color name. The use of color names is much easier and will work with most browsers. But the color value code will give you much more control over your color because you are not restricted to a certain few color names.

Either of these methods of incorporating color can be done simply by assigning the value into the "color" attribute of the appropriate HTML tag. <body style="background:silver"> for example, will create a web page with a silver background color.

Color Names

The standard color names that are readable by most browsers are:

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

Many people realized that these colors were rather limiting and so the people behind both both Netscape and Internet Explorer created many more color names to use. These are called the X11 color names. There are far too many of these color names to list here, but a small representative of the list is shown below. Also, there are a total of 100 variants of gray that you can use. The color “gray1” is the darkest and “gray100” is the lightest. The default “gray” shown above is similar to “gray75”.

aliceblue     beige      chartreuse      darkgoldenrod     dodgerblue      firebrick    
gainsboro      honeydew     hotpink     ivory     lawngreen     linen    
midnightblue      mintcream     oldlace     orchid      papayawhip     peru    
rosybrown     salmon     seashell     slateblue     thistle      whitesmoke    

As you can tell, some of the color names are rather odd. And what exactly is the difference between “honeydew” and “mintcream”? You quickly run into the problem that you have far too many names to reference and keep track of. Also, not all browsers can recognize these X11 colors. Which leads me to…

Color Values

If you want much more control of which color will be displayed, or if you feel you are limited by the choices given to you by the color names, then you will want to use color values to input within your HTML tags. This method is the only way to exactly match, for example, the background to a certain color in an image. The one caveat is that this method is somewhat more difficult to understand than the color name method.

All color values are created within an HTML tag by a six-digit hexadecimal number preceded by a hash (#) symbol. For example: “#FF0000” is the color red. This number is a representation of a color value called RGB which stands for Red-Green-Blue. So the first two digits represents the red color, the second two represents green and the last two, blue.

So what does hexadecimal mean? It is a base-16 numbering system that is commonly used by computers. Hexadecimal uses the normal 0 through 9 digits as well as adding the letters A through F as shown in this table:

Number 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F

So, to use color values, you will first need to know the RGB value of your color. (If you use a program such as Adobe Photoshop, this is easily determined.) Each of the three colors of an RGB color will run from 0 (no color) to 255 (full color). Thus full red is 255, 0, 0; full green is 0, 255, 0 and full blue is 0, 0, 255. This combination allows for 16 million different variations.

Once you know the RGB value, you will need to convert it to hexadecimal by using this formula: Divide each value by 16 and multiply the remainder by 16 to gain two digits.

For example: Let's say our RGB color is an dull blue (   ) that has an RGB value of 106, 90, 205. To find the hexadecimal equivalent, we just divide each value by 16 and multiply the remainder by 16. Thus 106 divided by 16 is 6.625. and 16 multiplied by 0.625 is 10. So the first (or red) hexadecimal number is "6A". The green number is 90, which divided by 16 results in 5.625. This makes the green hexadecimal number "5A". For the blue number of 205; 16 divided into it results in 12.8125 and 16 times 0.8125 is 13. So the blue hexadecimal equivalent is "CD". So the final equivalent to RGB 106, 90, 205 is 6A5ACD. This number can then be plugged into an HTML attribute like this: <span style="color: #6A5ACD;">This text is a dull blue color</span>

Fortunately, there are a number of tools you can either find online or download to your computer that will convert RGB to hexadecimal colors. Also, many HTML editors such as Macromedia Dreamweaver have these tools already built in.

One Last Thing

Many older and cheap computer monitors can only display a limited number of colors. Any color outside of this range would be displayed very poorly. This problem is complicated by the differences between PCs, Unix/Linux and Macs and how they each display color. To correct this problem, a collection of “Web Safe” colors was devised. These colors are safe to use and will not be altered by the computer’s monitor. The Web Safe palette of colors is shown below.

Web Safe Colors

Hex Code Color
#FFFFFF  
#FFFFCC  
#FFFF99  
#FFFF66  
#FFFF33  
#FFFF00  
#FFCCFF  
#FFCCCC  
#FFCC99  
#FFCC66  
#FFCC33  
#FFCC00  
#FF99FF  
#FF99CC  
#FF9999  
#FF9966  
#FF9933  
#FF9900  
#FF66FF  
#FF66CC  
#FF6699  
#FF6666  
#FF6633  
#FF6600  
#FF33FF  
#FF33CC  
#FF3399  
#FF3366  
#FF3333  
#FF3300  
#FF00FF  
#FF00CC  
#FF0099  
#FF0066  
#FF0033  
#FF0000  

Hex Code Color
#66FFFF  
#66FFCC  
#66FF99  
#66FF66  
#66FF33  
#66FF00  
#66CCFF  
#66CCCC  
#66CC99  
#66CC66  
#66CC33  
#66CC00  
#6699FF  
#6699CC  
#669999  
#669966  
#669933  
#669900  
#6666FF  
#6666CC  
#666699  
#666666  
#666633  
#666600  
#6633FF  
#6633CC  
#663399  
#663366  
#663333  
#663300  
#6600FF  
#6600CC  
#660099  
#660066  
#660033  
#660000  
Hex Code Color
#CCFFFF  
#CCFFCC  
#CCFF99  
#CCFF66  
#CCFF33  
#CCFF00  
#CCCCFF  
#CCCCCC  
#CCCC99  
#CCCC66  
#CCCC33  
#CCCC00  
#CC99FF  
#CC99CC  
#CC9999  
#CC9966  
#CC9933  
#CC9900  
#CC66FF  
#CC66CC  
#CC6699  
#CC6666  
#CC6633  
#CC6600  
#CC33FF  
#CC33CC  
#CC3399  
#CC3366  
#CC3333  
#CC3300  
#CC00FF  
#CC00CC  
#CC0099  
#CC0066  
#CC0033  
#CC0000  

Hex Color Color
#33FFFF  
#33FFCC  
#33FF99  
#33FF66  
#33FF33  
#33FF00  
#33CCFF  
#33CCCC  
#33CC99  
#33CC66  
#33CC33  
#33CC00  
#3399FF  
#3399CC  
#339999  
#339966  
#339933  
#339900  
#3366FF  
#3366CC  
#336699  
#336666  
#336633  
#336600  
#3333FF  
#3333CC  
#333399  
#333366  
#333333  
#333300  
#3300FF  
#3300CC  
#330099  
#330066  
#330033  
#330000  
 
Hex Code Color
#99FFFF  
#99FFCC  
#99FF99  
#99FF66  
#99FF33  
#99FF00  
#99CCFF  
#99CCCC  
#99CC99  
#99CC66  
#99CC33  
#99CC00  
#9999FF  
#9999CC  
#999999  
#999966  
#999933  
#999900  
#9966FF  
#9966CC  
#996699  
#996666  
#996633  
#996600  
#9933FF  
#9933CC  
#993399  
#993366  
#993333  
#993300  
#9900FF  
#9900CC  
#990099  
#990066  
#990033  
#990000  

Hex Code Color
#00FFFF  
#00FFCC  
#00FF99  
#00FF66  
#00FF33  
#00FF00  
#00CCFF  
#00CCCC  
#00CC99  
#00CC66  
#00CC33  
#00CC00  
#0099FF  
#0099CC  
#009999  
#009966  
#009933  
#009900  
#0066FF  
#0066CC  
#006699  
#006666  
#006633  
#006600  
#0033FF  
#0033CC  
#003399  
#003366  
#003333  
#003300  
#0000FF  
#0000CC  
#000099  
#000066  
#000033  
#000000  
 
Walter Scott, Jr. College of Engineering logo

Engineering Technology Services

Bookmark and use our online help desk form first.
 

Email help@engr.colostate.edu
Call (970) 491-2917
 

Stop by an ETS Help Desk:
Main Help Desk (Glover 100)
Foothills Campus Help Desk (Atmospheric Science 107)
Academic Village Help Desk (AVB C142, next to the Orion Design Studios)