Color Codes, RGB, and Hexadecimal

All colors on a computer monitor are created by mixing Red, Green, and Blue light. The varying intensities of those three colors is what creates the millions of colors your eye can detect. To describe those varying colors, the html hexadecimal color codes are made up of six-digits - two for Red, two for Green, and two for Blue. Since the largest two-digit hexadecimal number is FF (or two hundred fifty-six), there are two hundred fifty-six possibilities for each of the three colors in any color code. (In case you're interested, that means that there are 256*256*256 unique possibilities for colors or 16,777, 216!) Only 140 color names are recognized by browsers (here's the list if you want to take a look) but you can indicate over 16 million colors using RGB color codes!

The RGB color system is used to designate color values like this:

Hexadecimal code

Red value

Green value

Blue value

Result

#000000

0

0

0

white

#FF0000

256

0

0

red

#008000

0

128

0

green

#0000FF

0

0

256

blue

#FF9500

256

149

0

orange

#FF00FF

256

0

256

fuchsia

#800080

128

0

128

purple

#FF6347

256

99

71

tomato

#00FF7F

0

256

127

spring green

 

You Try It! Using Color Codes

To experiment with color codes, go to the html color codes website and scroll down to the HTML Color Picker. You can click a color and see the code or type in a code to see the color.

Now let's practice designating the color value of an element using color codes instead of color names.

Click here to open the Try-It Editor. Replace the color names with their equivalent color codes in the left side of the editor. Click See Results to refresh the right side of the editor to view the result.

Experiment with other color codes to change the text color.