Web Colors Article Index for
Web
Website Links For
Web
 

Information About

Web Colors




Web colors are Color s used in designing Web pages, and the methods for describing and specifying those colors.

Authors of web pages have a variety of options available for specifying colors for elements of web documents. Colors may be specified as an RGB triplet in Hexadecimal format (a ''hex triplet''); they may also be specified according to their common English names in some cases. Often a Color Tool or other Graphics Software is used to generate color values.

The first versions of Mosaic and Netscape Navigator used the X11 Color Names as the basis for their color lists, as both started as X Window System applications.

Web colors have an unambiguous colorimetric definition, SRGB , which relates the Chromaticities of a particular Phosphor set, a given transfer curve, adaptive whitepoint, and viewing conditions. These have been chosen to be similar to many real-world monitors and viewing conditions, so that even without Color Management rendering is fairly close to the specified values. However, User Agent s vary in the fidelity with which they represent the specified colors. More advanced user agents use color management to provide better color fidelity; this is particularly important for Web to print applications.


HEX TRIPLET

A hex triplet is a six-digit, three- Byte Hexadecimal number used in HTML and CSS , and other computing applications, to represent Color s. The bytes represent the red, green and blue components of the color. One byte represents a number in the range 00 to FF (in hexadecimal notation), or 0 to 255 in decimal notation. This represents the least (0) to the most (255) intensity of each of the color components. The hex triplet is formed by concatenating three bytes in hexadecimal notation, in the following order:
:Byte 1: red value
:Byte 2: green value
:Byte 3: blue value
For example, consider the color where the red/green/blue values are decimal numbers: red=36, green=104, blue=160 (a greyish-blue color). The decimal numbers 36, 104 and 160 are 24, 68 and A0 respectively in hexadecimal notation. To obtain the hex triplet, we simply write the three hex bytes together without spaces, thus: 2468A0. If a byte is less than 16 (decimal) or 10 (hex) it must be represented with a leading zero to keep the number of digits in the triplet equal to six. For example, the decimal triplet 0,1,2 would be represented by the hex triplet 000102.

The number of colors that can be represented by this system is
:256 imes 256 imes 256 = 16,777,216


Converting RGB to hexadecimal

Converting a decimal RGB value to a hexadecimal value is fairly straightforward. RGB values are usually given in the 0-255 range; if they are in the 0-1 range, multiply the value by 255 before conversion. The number of times this number divides into 16 (without rounding) gives us the first hexadecimal digit (between 0 and F, see Hexadecimal if unsure). The remainder gives us the second digit. For instance the RGB value 201 divides 12 times into 16, thus the first digit is C. A remainder of 9 gives us the hexadecimal number C9. This process is repeated for each color value. Most modern Operating System s have a built-in calculator to perform conversions between number bases; this can also be done with some calculators. This task can also be carried out with various Internet resources, for instance the website http://www.telacommunications.com/nutshell/rgbform.htm.


HTML COLOR NAMES


See Also: HTML color names



The HTML 4.01 specification HTML 4.01 Specification section 6.5 "Colors" defines sixteen named colors, as follows (names are defined in this context to be case independent; the table is alphabetically ordered):

These 16 were also specified as sRGB and included in the HTML 3.0 specification which noted "These colors were originally picked as being the standard 16 colors supported with the Windows VGA palette." HTML 3.2 Specification "The BODY element"

It should be mentioned that all color values from #000000 - #FFFFFF (16,777,216 colors) are valid.


X11 COLOR NAMES


In addition, a number of colors are defined by Web Browser s. A particular browser may not recognize all of these colors, but as of 2005 all modern general-use browsers support the full list. Many of these colors are from the list of X11 Color Names distributed with the X Window System . These colors were standardized by SVG 1.0 , and are accepted by SVG Full user agents. They are not part of SVG Tiny .

Almost the exact same color names are used in .NET Framework , in the KnownColor and Color enumerations. The only color difference is DarkSeaGreen which is defined as 8F,BC,8B (instead of 8F,BC,8F).

The list of colors actually shipped with the X11 product varies between implementations, and clashes with certain of the HTML names such as green. Furthermore, X11 colors are defined as simple RGB (hence, no particular color), rather than sRGB. This means that the list of colors found in X11 (e.g. in /usr/lib/X11/rgb.txt) should not directly be used to choose colors for the web. Public discussion on SVG mailing list ''Re: color names in SVG-1.0 conflict with /usr/lib/X11/rgb.txt''

The list of web "X11 colors" from the CSS3 specification, along with their hexadecimal and decimal equivalents,
is shown below, compare the alphabetical lists in the W3C standards.
W3C TR CSS3 Color Module, SVG color keywords W3C TR SVG 1.0, recognized color keyword names


  { Class "wikitable" style="background-color:#FFFcolor:black"
  { Width "80%" class="wikitable" style="color:whitewidth:80%text-align:center"
  { Class "wikitable"