HTML Colors

rev: 5/25/10 dd
Colors are displayed by combining Red, Green, and Blue light sources. HTML colors can be defined as hexidecimal codes to create a combination of Red, Green, and Blue (RGB) color values.

The lowest value (black or no brightness) that can be given to one light source is 0 (hex #00) and the highest value (maximum brightness) is 255 (hex #FF). The table below shows the result of combining Red, Green, and Blue light sources:

Color Color HEX Converted from HEX R G B Note
 
#000000
rgb(0,0,0)
0
0
0
no color
 
#FF0000
rgb(255,0,0)
255
0
0
max red
 
#00FF00
rgb(0,255,0)
0
255
0
max green
 
#0000FF
rgb(0,0,255)
0
0
255
max blue
 
#FFFF00
rgb(255,255,0)
255
255
0
max red & green
 
#00FFFF
rgb(0,255,255)
0
255
255
max green & blue
 
#FF00FF
rgb(255,0,255)
255
0
255
max red & blue
 
#C0C0C0
rgb(192,192,192)
192
192
192
some of all three
 
#FFFFFF
rgb(255,255,255)
255
255
255
max all three

Since each of the three colors has 16 x 16 = 256 (0-255) possible brightness levels, there are 166 = 2563 = 16.7 million possible colors in HTML. To create other colors, adjust the three color intensities or you can Google "HTML colors" to see Websites that have color examples.


Standard Color Names

As shown in the table below the world wide web consortium (W3C) has listed 16 color names that be used directly instead of using the hexidecimal equivalents.

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

For example for a blue background and white text in the body of and HTML document there are two equivalent ways of creating the tag:

<body bgcolor="blue" text="white"> is the same as <body bgcolor="#0000FF" text="#FFFFFF">

To obtain colors beyond these basic 16 colors, hexidemical must be used.