Part 3: Using Hexadecimal to Express Color


All colors are mixtures of the three primary colors: red, green, and blue. A hexadecimal color code uses a six digit number. The first two digits are the value for red, the next two for green, and the last two for blue. This is called the RGB (Red, Green, Blue) color model.

Example:

Hex Code "808080"= Red 80, Green 80, Blue 80

808080
808080
RedGreenBlue=Gray

This is a mixture of equal amounts of the three colors. The result is a medium gray.

Each value uses two hexadecimal digits, giving you 256 possibilities for each color. Since there are three colors, the total number of possible colors is 256 X 256 X 256 = over 16 million.

Black

If all values are set to 0, the screen will be black:

Black
Hex Code: 00 00 00


White

If they are set to the maximum (hex FF, decimal 255), the screen will be white.

White
Hex Code: FF FF FF


Gray

The screen is gray when all three colors are at the same value, somewhere between minimum (black) and maximum (white).

Dark Gray
Hex Code: 20 20 20


Medium Gray
Hex Code: 50 50 50


Light Gray
Hex Code: B0 B0 B0


Primary colors

To produce pure colors, leave two colors at 0, and set a value for the third color (the desired color).

Red
Hex Code: FF 00 00


Green
Hex Code: 00 FF 00


Blue
Hex Code: 00 00 FF


Mixing Colors

Set values for two or three of the colors to obtain colors that are a mixture of the primary colors.

Warning:

Mixing colors in HTML is directly opposite from mixing colors with paint. Low amounts of color make dark shade; high amounts of color make bright shades. With HTML, you are mixing light, not paint.

Yellow
Hex Code: F0 F0 00
(Red + Green)


Purple
Hex Code: 60 00 60
(Dark Red + Dark Blue)


Orange
Hex Code: FF 70 00
(Red + Medium Green)


Brown
Hex Code: 90 50 30
(Red, Green, and a little Blue)


Use the automatic color mixer to experiment.

Continue on to the Quiz

Back to Table of Contents


© Copyright 1997 Los Trancos Systems, LLC. Used with permission. All rights reserved.