Friday, August 1, 2008

Hexadecimal Code used in HTML

The RGB hexadecimal color code used in HTML uses a modified hexadecimal number to assign the color. The code is six digits long where the first two digits are the shades of red, the middle two digits are the shades of green and the last two digits are the shades of blue. These shades are blended by the browser to make the resultant color much the same way as we mix colors to make different shades of paint.


There are 16.7 million different colors in the hexadecimal color system. Each color can have as many as 162 = 256 shades of color. If all three colors take on the brightest shade, the resultant color #FFFFFF is white. If all colors take on the least brightest shade, the resultant color #000000 is black.


Each of the 6 digits in the hexadecimal code is broken into 3 separate groups...
#XXxxxx - Red Color Value
#xxXXxx - Green Color Value
#xxxxXX - Blue Color Value


Each digit is a value from 0 to F, in the hexadecimal system. The hexadecimal color system counts by 0 1 2 3 4 5 6 7 8 9 A B C D E F, with 0 being null value, and F being highest value.
So if the first two digits (red values) are full (FF) and the other four are null (00) the color will be red.

If the first two are null (00), the third and fourth digit (green value) are full (FF), and the fifth and sixth digit are null (00), the color will be green.

If the first four digits are null (00), and the fifth and sixth digit (blue value) are full (FF), the color will be blue.

No comments: