@spa-tools/utilities
parseColor
The parseColor
function converts an rgba or hex color string to a ColorObject
.
Usage
import { parseColor } from '@spa-tools/utilities';
const color = parseColor('#ff0000', 0.5);
console.log(color);
Arguments
Name | Type | Required? | Default | Description |
---|---|---|---|---|
hex | rgbOrRgbaOrHex | yes | - | Either an rgba or hex color string |
Returns
ColorObject
object.