Advanced HTML: Colors


There are two ways of specifying color in HTML (for attributes such as bgcolor in the body tag, etc.): by name, or by RGB (Red-Blue-Green) Hexadecimal number. Netscape supports the full X-Windows list of 752 colors by name (which allows things like "mistyrose" and "PapayaWhip"), but not all browsers are so savvy. In general, the 16 basic colors are safe:

black="#000000" silver="#c0c0c0" gray="#808080" white="#ffffff"
maroon="#800000" red="#ff0000" purple="#800080" fuchsia="#ff00ff"
green="#008000" lime="#00ff00" olive="#808000" yellow="#ffff00"
navy="#000080" blue="#0000ff" teal="#008080" aqua="#00ffff"

Each of these is identified by a name and a hexadecimal (base 16) number: the number is actually three numbers, corresponding (in order) to the amount of Red, Green and Blue in the color. In Hexadecimal we count

1 2 3 4 5 6 7 8 9 A B C D E F
So the Hex number 2A is 2 sixteens (32) plus A (which is ten), so 2A (base 16) = 42 (base 10).

Applying this to the RGB triples, the triple 0000ff is the number 00 followed by the number 00 followed by the number ff---zero red, zero green and lots of blue. So it's blue. The triple 883232 is the color of the header font of this page. Any RGB triple may be used; links on this page are 0000A0, visited links, 2F4F4F, and active links 00FFFF (which is the same as aqua).

For additional lists of RGB colors, etc., see
Doug Jacobson's RGB Color Chart,
the Colour test page in the HTML element list, Denis Wieger's color page, or
Gernot Metze's Color explanation.


[advhtml] [colors] [reuse] [valid] [images] [objects] [imaps] [tables] [frames] [forms]

[title] [objectives] [www uses] [the works] [basic html]
[adv html] [editors] [resources]   [feedback]

last modified (( Jun 17 07:47:00 1997 ))
HTML/WWW Wkshop: Adv HTML-Colors
©1997 Gavin LaRose
Comments to: glarose@NebrWesleyan.edu