@spa-tools/utilities
hexToRgba
The hexToRgba function converts a hex color string to an rgba color string.
Usage
import { hexToRgba } from '@spa-tools/utilities';
const rbgaColor = hexToRgba('#ff0000', 0.5);
console.log(rbgaColor);
// --> 'rgba(255, 0, 0, 0.5)'
Arguments
| Name | Type | Required? | Default | Description | 
|---|---|---|---|---|
hex | string | yes | - | Hex color string | 
opacity | number | no | 1 | Opacity color value | 
Returns
string - The color in rgba format.