Building 3D Models for the Web

Technical Details of 2D Web Graphics

Hexadecimal Format

The strange sequences of six letters and numbers that you see in HTML BODY tags, such as:
<BODY BGColor=ffcc99 TEXT=003399 VLINK=cc3300 LINK=663300>
are color specifications, containing two characters for each of red, green, and blue. For example, 364cf0 assigns 36 to red, 4c to green, and f0 to blue. 36, 4c, and f0 are base 16 numbers. The number system that we mortals use is base 10. When we write the number 57, we mean 5 tens and 7 ones. The number 36 in base 16 means 3 sixteens and 6 ones. This is equivalent to the base ten number 3x16 + 6 = 54.

Our familiar base 10 number system requires 10 digits--0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. We don't need any more than this because once we get past the number 9, we carry a digit to the tens place. Base 16 requires 16 digits. Conventionally, they are called 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, and f. Here are some base 16 numbers and their base 10 equivalents.

Base 16Base 10
00
11
22
33
44
55
66
77
88
99
a10
b11
c12
d13
e14
f15
101x16 + 0 = 16
111x16 + 1 = 17
121x16 + 2 = 18
131x16 + 3 = 19
141x16 + 4 = 20
363x16 + 6 = 54
c412x16 + 4 = 196
cc12x16 + 12 = 204
ff15x16 + 15 = 255
A 24 bit color monitor supports 256 levels of red, 256 levels of green, and 256 levels of blue. These levels are numbered 0 to 255 in base 10 (0 to ff in base 16). Photoshop uses base 10 for RGB colors, while HTML uses base 16. The HTML color ff00cc corresponds to the Photoshop color R 255, G 0, B 204, since ff corresponds to 255, 00 corresponds to 0 and cc corresponds to 204. Here are some common colors:

Color PhotoshopHTML
White R 255 G 255 B 255ffffff
Red R 255 G 0 B 0ff0000
Green R 0 G 255 B 000ff00
Blue R 0 G 0 B 2550000ff
YellowR 255 G 255 B 0ffff00
Black R 0 G 0 B 0000000
The 216 browser-safe colors are combinations of 00, 33, 66, 99, cc, and ff. For example, 33cc99 is a browser-safe color, but 04cf93 is not.

Go back to 2D Graphics Formats


| << | 2D Web Graphics Index | >> |

Maintained by H. Edward Donley <hedonley@grove.iup.edu>
Last Modified Monday, 13-Aug-2001 16:53:26 EDT