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

rotate

A small utility function that rotates the hue of a CSS color value by a given number of degrees.
It uses the hsl color model to do so.

The Gist

import { rotate } from '@weser/theme'

const rotated = rotate('red', 90)
const rotatedVariable = rotate('var(--background)', -45)

Parameters

ParameterTypeDescription
valuestringThe CSS color value to rotate the hue of.
degreesnumberThe number of degrees to rotate the hue by.

Returns

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

On this page