import { HexToRGBA, parseHex } from "@veno-ui/utils";
function classToHex(color, colors, currentTheme) {
  const [colorName, colorModifier] = color.toString().trim().replace("-", "").split(" ", 2);
  let hexColor = "";
  if (colorName && colorName in colors) {
    if (colorModifier && colorModifier in colors[colorName]) {
      hexColor = colors[colorName][colorModifier];
    } else if ("base" in colors[colorName]) {
      hexColor = colors[colorName].base;
    }
  } else if (colorName && colorName in currentTheme) {
    hexColor = currentTheme[colorName];
  }
  return hexColor;
}
function parseGradient(gradient, colors, currentTheme) {
  return gradient.replace(/([a-z]+(\s[a-z]+-[1-5])?)(?=$|,)/gi, (x) => {
    return classToHex(x, colors, currentTheme) || x;
  }).replace(/(rgba\()#[0-9a-f]+(?=,)/gi, (x) => {
    return `rgba(${Object.values(HexToRGBA(parseHex(x.replace(/rgba\(/, "")))).slice(0, 3).join(",")}`;
  });
}
export {
  classToHex,
  parseGradient
};
//# sourceMappingURL=color.mjs.map
