Color

Description:

The standard model for color on the internet is Red-Green-Blue (RGB). This is specified by three values from 0 to 255 (decimal) or 00 to ff (hexadecimal). This allows for 256x256x256 or more than 16.7 million different colors.

You create colors by specifying the mixtures of red, green and blue. Zero indicates there is no specific color and 255 indicates the color is totally saturated.

You can specify colors by some specific names, shown in the table below.

  Black #000000   Green #008000
  Silver #C0C0C0   Lime #00FF00
  Grey #808080   Olive #808000
  White #FFFFFF   Yellow #FFFF00
  Maroon #800000   Navy #000080
  Red #FF0000   Blue #0000FF
  Purple #800080   Teal #008080
  Fuchsia #FF00FF   Aqua #00FFFF

You may also use RR for red, GG for green and BB for blue.

The table above shows the 16 primary colors. The section titled "Color names" lists all of the remaining names of the 216 safe color set.

Examples:

<BODY BGCOLOR="#FFFFFF" LINK="#000080" VLINK="#800080" TEXT="#000000">

Defines the defaults for the current document. The background color is white (#FFFFFF), links will be shown in Navy (#000080), visited links in Purple (#800080) and text in black (#000000).

Tips:

  1. Use the color names where possible, as it makes your code easier to maintain.