Colours in HTML

This page is not about how to use colours for designing websites, as I am not a web designer. Rather, I use this page as a reference when I need to pick a colour while writing HTML.

Instead of using images, the palettes herein are generated from HTML in order to show their colours as rendered by your browser. The code shown in each cell is the value used to render the cell's colour. A colour value in HTML may either be a colour name or an RGB value. An RGB value is a six-digit hexadecimal (may be prefixed by a pound sign #) whose first two digits indicate the red value, second two digits indicate the green value and whose last two digits indicate the blue value. The range of each colour is 00 to FF inclusive.

Named Colours

The colour names shown in table 1 are the 16 widely understood colour names. They are originally picked as being the standard 16 colours supported with the VGA palette (the first 16 VGA colours). They are defined as part of the HTML specs. Note that colour names are case-insensitive.

There are more named colours than the 16 below, but they may not be supported by all browsers on all platforms. This colour table, as part of the HTML reference document written by Netscape Communications Corp. in 1997, shows more extensive colour names.

Table 1 - Named colours and their corresponding RGB hexadecimal umber.
black
000000
gray
808080
silver
C0C0C0
white
FFFFFF
red
FF0000
fuchsia
FF00FF
purple
800080
maroon
800000
navy
000080
blue
0000FF
teal
008080
aqua
00FFFF
yellow
FFFF00
lime
00FF00
green
008000
olive
808000

Gray Scale

A gray scale is a scale of nuances between the colours black and white. In technical terms, a gray scale is composed of colours whose RGB red, green and blue values are the same (e.g. 6A6A6A). Table 2 below shows two gray scales. The first one is a scale of six, all part of the web-safe colours. The second one has more nuances, but they are not all web-safe colours. (Of course, there are much more gray and colour nuances than what is shown herein).

000000 333333 666666 999999 CCCCCC FFFFFF

Web-Safe Colours

Back in the time when most computers only had 8-bit (256 colours) graphic cards, there were incompatibilities in using the full 256 colour palette across platforms (i.e. Windows, Mac, X-window and Unix). The problem is that some operating systems (OS) reserve certain colours for system use, thus making them unavailable to the browsers.

To avoid that problem, a 216-colour palette has been created, which will not dither on most platforms. The 216-colour palette consists of - guess - 216 colors; 6 colors for the red, 6 for the green and 6 for the blue. Those 6 colors are 00, 33, 66, 99, CC and FF in hexadecimal (or 0, 51, 102, 153, 204 and 255 in decimal). Together, they form a 6x6x6 (=216) colour matrix or "cube" (see Table 3).

There are many names used for the 216-colour palette: browser-safe palette, Netscape colour cube, cross-platform colours etc. For what it worth, I refer to them herein as web-safe colours.

These 216 colours can be arranged according to their nuances as done at this site. But I am too lazy to do so, and prefer to have a script generate them as shown above.

Also, with today's personal computers, one can express oneself in more colours than the above web-safe colour palette.

Resources

Non-Dithering Colors in Browsers
Author of Design Web Graphics (that I have not read), Lynda Weinman is the first to publish on the web-safe colours. In this article, she discusses the use of the browser-safe palette.
Optimizing Web Graphics: Which Color Palette?
Part of the Optimizing Web Graphics article by Andrew B. King, this page explains in more details the 216-colour palette.
Colorizer
Colour picker tool from WebReference. The Colorizer is a Java applet that helps web authors to pick colours. It displays different colour palettes, and tells the RGB, hue, saturation and brightness values of the selected colour.
RGB to Hex
A web tool that shows the RGB value of a colour.