liveBook · Manning

Complementary color relationship

As explained in Math for Web Design

A complementary color scheme is a color arrangement based on a hue and the hue positioned opposite it on the color wheel.

A complementary color relationship pairs a hue with the hue directly opposite it on the color wheel. In HSL, the opposite hue is 180 degrees away. section 7.3.1

Calculate the complementary hue by adding 180 degrees and wrapping within the 360-degree color wheel:

CSS-generated complementary colors

Store a base hue in a custom property and derive its complement with hsl() and calc(): --main-color uses the base hue, while --comp-color adds 180 degrees. CSS handles the wraparound. section 7.3.1

How Math for Web Design covers it

How deep it goes
Explains the 180-degree relationship, works through hue calculations, and implements the result with CSS variables and functions.
Examples
Uses red and cyan, hue 240 and yellow, and hue 225 wrapping to hue 45.
What you can do after
Apply it via CSS by calculating complementary HSL hues with custom properties, calc(), or mod().
How it connects
Connects color wheels, HSL hue values, CSS custom properties, calc(), and modulo arithmetic.

Also explained in

Compare how 5 books explain complementary color relationship →

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.