Theme
/ API Reference / Color ManipulationTheme
/ API Reference / Color Manipulationtransparentize
A small utility function that decreases the alpha (opacity) of a CSS color value by a relative amount.
It uses the hsl color model to do so.
The Gist
import { transparentize } from '@weser/theme'
const moreTransparent = transparentize('red', 0.2)
const transparentVariable = transparentize('var(--background)', 0.5)
Parameters
| Parameter | Type | Description |
|---|---|---|
| value | string | The CSS color value to decrease the alpha. |
| amount | 0-1 | The relative amount to decrease the alpha. |
Returns
(string) A string that references a CSS color value with the alpha decreased.
© 2024-present Robin Weser. All Rights Reserved.