frontAnswerer/lib/utils/hexToRgba.ts
2024-03-05 14:53:30 +03:00

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})`;
};