import { percentToHex } from './chunk-2FGIY4B7.mjs';

// src/alphaHex.ts
var HEX_LENGTH = 6;
var HEX_OPACITY_LENGTH = 8;
function alphaHex(hex, alpha) {
  if (!hex) {
    throw new Error("Hex value is required");
  }
  if (hex.length === HEX_OPACITY_LENGTH) {
    return `${hex.slice(0, HEX_LENGTH)}${percentToHex(alpha)}`;
  }
  return `${hex}${percentToHex(alpha)}`;
}

export { alphaHex };
