Understanding HTML Color Codes

 Understanding HTML Color Codes

 

I help people with web pages a lot and I usually encourage them to edit the HTML directly and not rely on GUI layout programs like Microsoft FrontPage or Adobe GoLive to  hex,  layout their pages. A lot of people have a trouble understanding what HTML Color Codes mean and how they work.

HTML Color Codes are 6 characters wide and look like “#80FF12”, and are really 3 2-digit hex numbers that represent Red, Green, and Blue. Ok… I just lost a good portion of the crowd didn’t I? Let’s break it down into things that are easy to understand.

How to describe a color using numbers? There are a lot of ways to specify a particular color, but one of the ways that’s used with computers is to specify the values of Red, Green, and Blue to mix together to achieve the desired color. As we vary the amounts of Red, Green, and Blue we can create most any color you desire.

How does this relate to computers? Computer displays, TVs, and other “projected light” display devices use pixels to display what you see on the screen and the color value for those pixels is specified in a RGB (Red, Green, Blue) value. For example if your monitor is set at 1024 x 768 resolution, then there are 768 lines (from top to bottom) on your screen, and each line has 1024 pixels or little dots in it. Each of those pixels or little dots is actually made of three smaller dots or light sources: a red one, a green one, and a blue one.

Ink works differently. Computer printers generally specify color as a four (or more) color “reflective” ink value made up of Yellow, Magenta, Cyan, and Black which is abbreviated as YMCK. The computer uses various formulas to convert the RGB values to CMYK values so that you can print what you see on your screen accurately.

How does the computer represent a RGB color value? RGB values are stored as 3 separate values (one for Red, one for Green, and one for Blue) between 0 and 255. If you count the 0 as a value, then that’s a total of 256 possible values. When you combine the Red, Green, and Blue values together to represent a color you get a possibility of 16.7 million colors (256 x 256 x 256). That’s a lot of colors and most people consider this to be “true” color because it can represent most photographs and images accurately and naturally.

What is a Hex number? Your computer stores information as single ones and zeros. Each of these 0s and 1s is a single value called a “bit”. When we combine 8 of these “bits”

 

 

Leave a Comment