liveBook · Manning

Brightness

As explained in Math for Web Design

Perceived brightness is the visual intensity or lightness of a color or visual stimulus as experienced by human vision.

Brightness is how light or dark a color appears. Color spaces expose related controls differently: HSL lightness runs from black at 0% to white at 100%, while LAB and OKLCH use a lightness axis. In HSL, 50% is normal brightness; in OKLCH, lightness is designed to correspond more closely to perceived brightness. section 7.1.2 section 7.1.4

Do not treat RGB channel values as a direct measure of perceived brightness. Human vision is more sensitive to green and less sensitive to blue, so RGB-to-grayscale conversion uses a weighted average rather than a simple channel average. section 7.2.1

Build a consistent color scale

Keep OKLCH chroma and hue fixed, then vary lightness: `oklch(0.8 0.15 350)`, `oklch(0.6 0.15 350)`, and `oklch(0.4 0.15 350)` create light, medium, and dark versions of one brand color. Unlike HSL hue rotation, OKLCH hue adjustments retain the same perceived brightness. section 7.1.4

For dark mode, simple RGB inversion can distort relative contrast and make muted colors garish. A more controlled starting point is to invert lightness while retaining hue and saturation, then reduce saturation or chroma, optionally shift hue, and test contrast against the new background. section 7.5.1 section 7.5.4

Listing 7.3 Converting RGB to grayscale using a weighted average
function rgbToGrayscale(r, g, b) {
    return 0.299 * r + 0.587 * g + 0.114 * b;    #1
}

Use the weighted RGB formula to see why equal channel averaging does not match apparent brightness. section 7.2.1

How Math for Web Design covers it

How deep it goes
Defines lightness controls, derives weighted grayscale brightness, and applies lightness inversion without deriving perceptual color-space internals.
Examples
Uses weighted RGB grayscale conversion, HSL and OKLCH inversion, and fixed-hue OKLCH lightness scales.
What it assumes
Introduces the needed color-model values and arithmetic from RGB channels through lightness-based transformations.
What you can do after
Apply it via CSS and JavaScript to generate grayscale colors, controlled scales, and starting dark-mode palette transformations.
How it connects
Connects brightness with HSL, LAB, OKLCH, RGB, grayscale, luminance, contrast ratios, saturation, chroma, and dark mode.

Also explained in

Compare how 7 books explain brightness →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Math for Web Design. The section links point to the parts of the book it draws on.