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:
- H = 0 produces 180: red complements cyan. section 7.3.1
- H = 240 produces 60: a blue hue complements yellow. section 7.3.1
- H = 225 produces 45 because 225 + 180 wraps to 45. section 3.2.4
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




