Jump to content

7.1.2 How Computers See Color (RGB, basic idea)

From Computer Science Knowledge Base

7.1.2 How Computers See Color (RGB, basic idea)

How does a computer know what color each pixel should be? It's all done with numbers!

The most common way computers represent colors is using the RGB model. RGB stands for Red, Green, and Blue. These are called "additive primary colors" because when you mix different amounts of light of these three colors, you can create almost any other color.

  • Each pixel's color is defined by how much red, how much green, and how much blue light it should have.
  • Each of these three colors (Red, Green, Blue) is given a number, usually from 0 to 255.
  • 0 means no amount of that color.
  • 255 means the maximum amount of that color.

So, a pixel's color might be represented as a combination like:

  • (255,0,0) = Pure Red
  • (0,255,0) = Pure Green
  • (0,0,255) = Pure Blue
  • (0,0,0) = Black (no color light)
  • (255,255,255) = White (all colors at maximum brightness)
  • (255,255,0) = Yellow (Red + Green)

By combining these three numbers, a computer can represent millions of different colors for each tiny pixel, making images look vibrant and realistic.

Bibliography:

Further Reading: