Mathwords logoMathwords

RGB Color Model — Definition, Formula & Example

The RGB color model is a way to describe any color on a screen as a mix of red, green, and blue light. Each color gets three numbers that say how bright each light is.

The RGB color model is an additive color model. It represents a color as an ordered triple (R,G,B)(R, G, B) of nonnegative intensities of the red, green, and blue primaries. In standard 8-bit digital form, each component is an integer from 00 to 255255, so every color is a lattice point of the cube [0,255]3[0, 255]^3.

Key Formula

N=n3N = n^3
Where:
  • NN = Total number of distinct colors the model can represent
  • nn = Number of possible intensity levels for each channel (256 for values 0 through 255)

How It Works

Because RGB mixes light, adding more of a channel makes the color brighter. The triple (0,0,0)(0, 0, 0) is black, meaning all lights are off. The triple (255,255,255)(255, 255, 255) is white, meaning all lights are at full strength. Full red plus full green, (255,255,0)(255, 255, 0), gives yellow. Red plus blue gives magenta, and green plus blue gives cyan. When all three values are equal, such as (128,128,128)(128, 128, 128), you get a shade of gray.

Worked Example

Problem: A computer screen stores each pixel's red, green, and blue values as whole numbers from 0 to 255. How many different colors can one pixel display?
Step 1: Count the possible values for one channel. The list 0 through 255 includes both endpoints.
255−0+1=256255 - 0 + 1 = 256
Step 2: The red, green, and blue choices are independent. Use the multiplication principle across all three channels.
256×256×256=2563=16,777,216256 \times 256 \times 256 = 256^3 = 16{,}777{,}216
Step 3: Since 256=28256 = 2^8, each channel uses 8 bits. That makes 24 bits per pixel, which is why this is called 24-bit color.
2563=(28)3=224256^3 = (2^8)^3 = 2^{24}
Answer: One pixel can display 16,777,216 different colors, or 2242^{24}.

Why It Matters

Web designers write RGB colors as hex codes. In #FF8000, the pair FF is 255, 80 is 128, and 00 is 0, so the color is orange (255,128,0)(255, 128, 0). Programming and graphics courses use these triples to edit photos, build video games, and code websites in HTML and CSS.

Common Mistakes

Mistake: Saying each channel has 255 possible values because the maximum is 255.
Correction: The range starts at 0, so there are 255−0+1=256255 - 0 + 1 = 256 values. Using 255 gives 2553=16,581,375255^3 = 16{,}581{,}375 colors, which undercounts by almost 200,000.

Related Terms

  • Number Line — Each channel is a scale from 0 to 255
  • Whole Numbers — Brightness values are often whole numbers from 0 to 255
  • Ordered Pair — Order matters in coordinates, just as (R, G, B) order matters
  • Nonnegative — Brightness values in the model are never negative