frontAnswerer/lib/utils/hexToRgba.ts

8 lines
231 B
TypeScript
Raw Permalink Normal View History

2024-03-05 11:53:30 +00:00
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})`;
};