Skip to main content

saturate

function

Adjust the saturation of a color. Works in HSL space.

function saturate(color: string, amount: number): string

Import

import { saturate } from '@modular/sdk/theme';

Notes

returns
The adjusted color as hex or rgba string
throws
Error if the color format is invalid or amount is out of range
example
```ts saturate('#808080', 50) // Increase saturation saturate('#ff0000', -30) // Decrease saturation (desaturate) ```