Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
Note You may receive an error message if you copy the examples directly from this article and paste them in FrontPage. The angle brackets (< and >) may appear as escaped HTML code (< and >). To work around this behavior, paste the script in a blank Notepad document, and then copy it from Notepad before you paste it in FrontPage.
Several HTML tags allow you to specify colors in HTML documents. For example, to set the background color and the default color of text, use the BGCOLOR and TEXT attributes of the BODY tag:
<body bgcolor="#hex value" text="#hex value>
To specify the color of specific text, use the COLOR attribute of the FONT tag:
<font color="#hex value">
The hex values are a combination of six hexadecimal digits that are read left to right in pairs, representing the color levels for Red, Green, and Blue (RGB) respectively. These values allow for 24-bit color resolution, or a total of 16,777,216 possible colors. However, not every computer is capable of displaying all of these colors.
Since most computers are capable of displaying at least 256 colors, a
Safe Palette of colors was created. This palette is constructed by incrementing each color value by 51 decimal, or 33 hexadecimal. (For example, the values 00, 33, 66, 99, CC, and FF.) This allows for a palette of 216 colors, which stays inside the range of possible colors for a computer that supports 256 colors.
The following table lists the hex values for the 216 colors that make up the
Safe Palette of colors for web browsers:
To use a specific color, you simply need to specify the color value. The following example, uses the hexadecimal color values, to set the background color to blue, the default color for text to white, and the color of of text in a specific range of pages to black:
<body bgcolor="#0000FF" text="#FFFFFF">
<p>White text on Blue background.</p>
<p><font color="#000000">Black text on Blue background.</font></p>
</body>