Theme
/ API Reference / Color Manipulation
Theme
/ API Reference / Color Manipulation

complement

A small utility function that returns the complementary color by rotating the hue by 180 degrees.
It uses the hsl color model to do so.

The Gist

import { complement } from '@weser/theme'

const complementary = complement('red')
const complementVariable = complement('var(--background)')

Parameters

ParameterTypeDescription
valuestringThe CSS color value to get the complement of.

Returns

(string) A string that references a CSS color value with the hue rotated by 180 degrees.

On this page