8 lines
231 B
TypeScript
8 lines
231 B
TypeScript
import hexRgb from "hex-rgb";
|
|
|
|
export const hexToRgba = (hexColor: string, opacity?: number): string => {
|
|
const { red, green, blue, alpha } = hexRgb(hexColor);
|
|
|
|
return `rgba(${red}, ${green}, ${blue}, ${opacity || alpha})`;
|
|
};
|