YOOtheme
Matching Colors
A task frequently encountered while writing html pages is the matching of colors. Graphic programs use three decimal values to express a color.

For example the RGB system requires three numbers between 0 and 255 to set the color. R=245, G=245, and G=245, will give a light shade of gray. Unfortunately HTML requires the color of fonts and backgrounds to be expressed in hexadecimal.

For example the <font> tag requires six numbers to set the color <font color=#F5F5F5> where the first two digits define the red, the next two digits define the green, and the last two digits define the blue. So when we find a color that matches we have to convert decimal numbers to hexadecimal. This is easier than it sounds. Decimal numbers go from zero to nine: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. From these ten numbers all other numbers can be composed.

Hexadecimal has sixteen number which go from zero to 15: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. The idea is that we can express, with a single digit, sixteen numbers (counting zero) as opposed to ten in the decimal system. How can we then find the hexadecimal number that matches our required decimal? First we divide the RGB number by 16. In our example this would be 245/16 = 15 with 5 left over. From the list of hexadecimal numbers we can see that 15 is expressed as F. Next we add the remainder 5 to F making it F5, thus our RGB number of R=245, G=245, B=245, becomes the hexadecimal number #F5F5F5.

To use the colormatcher click on the sliderbar handle and, while holding the mouse button down, pull it to the position desired.

Comments
Only registered users can write comments!

3.20 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."