RGB To HEX

If the requirements for creating HTML files had been created by me, you would specify color using words like red, or dark red, or reddish orange, and so forth. There are two chances of my ever saying make the headline FF0000.Slim, and extremely slim. At most, I might use RGB (Red Green and Blue) values to describe a color.

But I would never have invented the HTML language either. Or the clock, or the adding machine, the refrigerator, or the atom bomb for that matter. So I guess someone had to invent HTML language and specifications and that determined that colors would be expressed in Hexadecimal language which my dictionery describes as "of, relating to, or being a number system with a base of 16."

Now I know that Robert H. Olley, and some of the less mathematically-challenged readers out there will know exactly what a number system with a base of 16 means. But your editor (that's me) had to take Algebra several times to get a passing grade.

But here's what I do know. Web-safe, or non-dithering colors, contain one of six RGB values: 0, 51, 102, 153, 204, or 255. This creates the possibility of 216 colors, which is the exact number of web-safe colors. Co-incidence? You decide.

And I do know the Hexadecimal equivilants for these 6 values.

RGB

=Hex

0

00

51

33

102

66

153

99

204

CC

255

FF

Hexadecimal equivilants for RGB colors are written in three sets of two figures, the first two figures represent Red, the second two figures represent Green and the third set of figures represents Blue.

So, if you have a color, like the one for the background color in the chart on the left that is RGB 255, 153, 102, this color is expressed FF9966 in Hexadecimal.

So where do you use these Hexadecimal values anyway?

The first place you'd use Hexadecimal values is in the Body tag of your HTML document. <BODY BGCOLOR="FFCC00" TEXT="000000" LINK="0099FF" VLINK="990066 " ALINK="FF3399 "> I've applied the colors to the values to show what each is. This statement replaces the opening <BODY> tag in your HTML document.

Another place where you can use these cool Hexadecimal values is in your font tags. For example, the statement <FONT FACE="Verdana" COLOR="666633 "> Make this text green and use Verdana for the type face </FONT> looks like this Make this text green and use Verdana for the type face.

Sean Sedwards produced this table of HEX to RGB for all 256 RGB values for those of you who want to be able to express more than 216 colors. With the three RGB values you can specify 16.7 million (give or take a few dozen) colors in 6 digits.

Finally this. Non-dithering, or Web-safe colors, will display solid on any computer monitor capable of displaying 256 colors. These colors will display the same when viewed in Windows and Macintosh browsers. Non-dithering colors are best used for text, and colors to made transparent in web graphics.

Coming soon, All I Know About Mathematics on the Head of a Pin by Gary W. Priester.