| Thursday, August 28, 2008 | Home | About | Software | Statistics Calculators | Programming | Web Development |
|
Overview of the Web Color Model When working with the HyperText Markup Language (HTML) or Cascading Style Sheets (CSS), a web designer must use the web color model in order to specify the colors of the elements on a web page (e.g., font colors, background colors, etc.). The web color model is based on a hexadecimal representation of the RGB color model, which allows the user to specify one of 256 possible numeric values for each of the three primary colors: Red, Green, and Blue. These numeric values represent the concentration of each primary color, and can range from 0 to 255, inclusive. The specified levels of each primary color are then mixed together to define the final color. As the user can specify one of 256 levels for each of the three primary colors, the RGB color model allows for a total of: 256 x 256 x 256 = 16,777,216 possible unique colors. That's a lot of colors! The RGB color model itself is an additive color model: this means that if a value of zero is specified for a particular primary color on the range from 0 to 255, then none of that color should be contained in the mix. Conversely, a value of 255 indicates that the full intensity of the current primary color should be contained in the mix. RGB values are specified as a numerical triplet, with the first number in the series representing the concentration of Red, the second number representing the concentration of Green, and the third number representing the concentration of Blue. Given the discussion of additivity above, the triplet 0,0,0 represents pure Black in the RGB model, while the triplet 255,255,255 represents pure White. Similarly, 255,0,0 represents pure Red, 0, 255,0 represents pure Green, and 0,0, 255 represents pure Blue.
By extension, the mixing of the full intensities of two of the three primary colors will yield one of the three secondary colors:
By varying the concentrations of the three primary colors, more than sixteen million colors can be defined using the RGB color model! As noted above, the web color model uses hexadecimal numbers to represent the levels of Red, Green, and Blue in a given color. In the hexadecimal model, a single digit can take on one of sixteen possible values. These values are represented using the following characters: 0 1 2 3 4 5 6 7 8 9 A B C D E F Using this approach, only two digits are required to specify one of the 256 possible values of each primary color, because: 16 x 16 = 256 Pure black, then, is defined as 00,00,00 in hex format, while pure white is FF,FF,FF. Similarly, FF,00,00 represents pure Red, 00,FF,00 represents pure Green, and 00,00,FF represents pure Blue.
Again, mixing the full intensities of two of the three primary colors will yield one of the three secondary colors:
|
||||||||||||||||||
|
||||||||||||||||||
| Copyright © 2004-2008 by Daniel S. Soper. All rights reserved. |