liveBook · Manning

Hue

As explained in CSS in Depth, Second Edition

Hue is a color-space component representing a dominant color family, commonly expressed as an angle around a color wheel.

Hue identifies a color’s position around a color circle. In CSS HSL, it is the first value: hsl(198deg 73% 46%) has a cyan-blue hue. Red is at 0deg, yellow at 60deg, green at 120deg, cyan at 180deg, blue at 240deg, and magenta at 300deg. The circle returns to red at 360deg, so angles outside one turn can be reduced by adding or subtracting 360deg. The angle can also be written without deg. section 11.2.2

Hue alone does not determine the resulting color. In HSL, saturation controls intensity: at 0%, the result is gray regardless of hue. Lightness controls how light or dark it is, reaching black at 0% and white at 100%. Separating these values makes a color such as hsl(198deg 73% 46%) easier to reason about than its equivalent hex value, #2097c9. section 11.2.2

Keep a palette in the same color family

In OKLCH, three related greens can use hue angles near 165deg while varying their other values. To try a lighter green, start with oklch(85% 0.12 165deg), then adjust lightness and chroma in browser DevTools. If several definitions share a hue, store the angle in a custom property and use it in values such as oklch(45% 0.09 var(--brand-hue)). section 11.3.1

Listing 11.6 Converting hex colors to OKLCH
@layer theme {
  :root {
    --brand-green: oklch(45% 0.09 165.4deg);      #1
    --dark-green: oklch(59% 0.12 164.1deg);       #1
    --medium-green: oklch(74% 0.15 166.4deg);     #1
    --text-color: oklch(26% 0.01 0deg);             #2
    --gray: oklch(64% 0.02 248deg);                 #2
    --light-gray: oklch(96% 0.003 248deg);          #2
    --extra-light-gray: oklch(98% 0 0deg);
    --white: oklch(100% 0 0deg);
  }
}

The palette listing puts related green hue angles side by side, making their shared color family easier to spot than in hex notation. section 11.3.1

Use a shared hue when developing related colors, but check the result visually. Before relying on OKLCH in a project, check browser support for the target audience and provide older-format fallback values where needed. section 11.3.1

How CSS in Depth, Second Edition covers it

How deep it goes
Defines HSL hue as an angle, explains its color-circle positions and wraparound, then applies nearby OKLCH angles to a palette.
Examples
Compares hsl(198deg 73% 46%) with #2097c9 and shows related OKLCH greens near 165deg.
What you can do after
Apply it via CSS HSL or OKLCH to choose related colors and refine them in browser DevTools.
How it connects
Connects hue to HSL, saturation, lightness, OKLCH, chroma, CSS custom properties, and color palettes.

Also explained in

Compare how 6 books explain hue →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of CSS in Depth, Second Edition. The section links point to the parts of the book it draws on.