Sub topic 2
Additive mixing: how screens make colour from light
This chapter assumes you know what a pixel is and can read simple arithmetic. The optional code uses CSS and JavaScript, but you can follow the ideas without running it.
What additive mixing means
Additive mixing builds colour by adding light. You start with darkness and add coloured light until you reach the colour you want. A screen is a good example: a black pixel emits no light, and every colour comes from light the pixel gives off.
Each pixel on a typical display has three small light sources, called subpixels. One is red, one is green and one is blue. The display changes how bright each subpixel is. Your eye cannot resolve the subpixels at normal viewing distance, so it blends their light into a single colour.
The three primaries and their mixtures
Red, green and blue are the additive primaries. Mixing two of them at full brightness gives a secondary colour. Mixing all three at full brightness gives white.
| Light mixed | Result |
|---|---|
| Red + green | Yellow |
| Green + blue | Cyan |
| Red + blue | Magenta |
| Red + green + blue | White |
| None | Black |
Yellow from red and green surprises many people who learned to mix paint. It works because your eye has separate cone cells that respond mostly to red, green and blue light. Red and green light together stimulate the red and green cones, and the brain reads that signal as yellow. The light itself does not turn into a yellow wavelength.
Brightness gives more than eight colours
The table shows only full-on or fully off subpixels. Real displays also set intermediate brightness for each subpixel. Red at full brightness with green at half brightness gives orange. Equal amounts of all three at a low level give grey. Equal amounts at full level give white.
This is why additive mixing is the base of the RGB model, which the next chapter covers. A colour on screen is described by three numbers, one for each subpixel's brightness.
Seeing it in code
CSS lets you set the three brightness values directly. The first rule below uses orange, with red full, green about half and blue off. The second shows that equal values give greys.
.orange {
background-color: rgb(255 136 0);
}
.grey {
background-color: rgb(128 128 128);
}
.white {
background-color: rgb(255 255 255);
}
.black {
background-color: rgb(0 0 0);
}The JavaScript below mixes two light sources by adding their channel values. It caps each channel at 255, because a subpixel cannot get brighter than full.
function addLight(a, b) {
return a.map((value, i) => Math.min(255, value + b[i]));
}
const red = [255, 0, 0];
const green = [0, 255, 0];
const blue = [0, 0, 255];
console.log(addLight(red, green)); // [255, 255, 0] yellow
console.log(addLight(addLight(red, green), blue)); // [255, 255, 255] white
console.log(addLight([200, 0, 0], [200, 0, 0])); // [255, 0, 0] clippedThe last line shows a limit of the model. Adding more light than the display can produce does not give a brighter red. The value is clipped at the maximum.
Common errors
- Applying paint intuition to light. Blue and yellow paint make green, but blue and yellow light make a grey or white, because yellow light already contains red and green. Additive and subtractive mixing follow different rules.
- Expecting black from mixing. Adding light only moves a colour towards white. To get darker, you lower the brightness values.
- Treating the sum as a plain average. The code above adds values directly, which is a simple model. Real displays also encode brightness non-linearly, so channel numbers do not match light intensity one to one. A later chapter on sRGB and gamma covers this.
- Forgetting that screens emit light. A screen is visible in a dark room, while a printed page is not. This is the practical difference between additive and subtractive colour.
Why this matters for design
Any deliverable viewed on a screen, such as a website, an app or a slide deck, uses additive colour. Colour values for those formats are RGB values, and the hex codes in later chapters are a compact way of writing them. Print uses the opposite approach, which the subtractive mixing chapter covers.
Exercise
A pixel has its red subpixel at full brightness, its green subpixel at full brightness, and its blue subpixel off. What colour do you see, and what is the matching rgb() value in CSS?
Show answer
You see yellow. The CSS value is rgb(255 255 0). Red and green light together stimulate the red and green cones in your eye, which the brain reads as yellow.
Exercise
Using the addLight function, what does addLight([100, 150, 200], [100, 150, 200]) return, and why is the last value not 400?
Show answer
It returns [200, 255, 255]. Each channel is capped at 255 because a subpixel cannot emit more than full brightness, so 150 + 150 = 300 becomes 255 and 200 + 200 = 400 becomes 255.