export const hexToRgba = (hexColor: string, opacity: number) => {
  const pureHexColor = hexColor.slice(1);

  const re = new RegExp(`.{1,${pureHexColor.length / 3}}`, "g");
  const colors = pureHexColor.match(re);

  return colors
    ? `rgba(${colors
        .map((n) => parseInt(n.length === 1 ? n.repeat(2) : n, 16))
        .join(", ")}, ${opacity})`
    : "";
};
