Theming
/ API Reference / Color ManipulationTheming
/ API Reference / Color Manipulationalpha
A small utility function that applies an alpha channel to a CSS color value.
It uses the hsl
color model to do so.
The Gist
import { alpha } from '@weser/theming'
const transparentRed = alpha('red', 0.5)
const transparentVariable = alpha('var(--background)', 0.5)
Parameters
Parameter | Type | Description |
---|---|---|
value | string | The CSS color value to apply the alpha to. |
alpha | 0-1 | The alpha value as a float from 0 to 1. |
Returns
(string
) A string that references a CSS color value with an alpha channel applied.
Import Alias
For convenience, we also export a shorthand import alias.
import { a } from '@weser/theming'
© 2024-present Robin Weser. All Rights Reserved.