Publishers of technology books, eBooks, and videos for creative people

# Web Design for Programmers, Part 2: Color

• Print

## The RGB Color Space

For the purposes of computer use, colors in the RGB color space are described by a sequence of three numbers. Each number represents the amount of Red, Blue, or Green component respectively, on a scale of 0 to 255. This allows each value to fit in a one-byte space. For example, Cyan is created by mixing Green and Blue, with no Red, represented as 0, 255, 255. In hexadecimal, the digits are commonly run together as a single 24-bit value: 00FFFF.

On the RGB color wheel, the six colors are shown in Table 1.

#### Table 1-The RGB Color Wheel as 24-bit Values

 Color Decimal Hexadecimal Red 255, 0, 0 FF0000 Yellow 255, 255, 0 FFFF00 Green 0, 255, 0 00FF00 Cyan 0, 255, 255 00FFFF Blue 0, 0, 255 0000FF Violet 255, 0, 255 FF00FF

Given a 24-bit color space, it is possible to represent more than 16 million colors (16,777,216). Unfortunately, not all computer systems are capable of displaying that many colors. Trying to display too many colors on a system that is not capable of displaying more than a few colors can create unique problems. That is why the engineers who created the first graphical Web browsers created a limited color space for use on the Web.