Skip to main content
@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

NameTypeRequired?DefaultDescription
hexrgbOrRgbaOrHexyes-Either an rgba or hex color string

Returns

ColorObject object.