Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(color: string): ColorRGBA64 => {
let parsed: ColorRGBA64 | null = parseColorHexRGB(color);
if (parsed !== null) {
return parsed;
}
parsed = parseColorWebRGB(color);
if (parsed !== null) {
return parsed;
}
throw new Error(
`${color} cannot be converted to a ColorRGBA64. Color strings must be one of the following formats: "#RGB", "#RRGGBB", or "rgb(r, g, b)"`
);
}
);