@mantine/core
Version:
React components library focused on usability, accessibility and developer experience
22 lines (18 loc) • 540 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
function hexToRgba(hex, alpha) {
if (!hex || typeof alpha !== "number" || alpha > 1 || alpha < 0) {
return "";
}
const replaced = hex.replace("#", "");
if (replaced.length !== 6) {
return "";
}
const parsed = parseInt(replaced, 16);
const r = parsed >> 16 & 255;
const g = parsed >> 8 & 255;
const b = parsed & 255;
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
}
exports.hexToRgba = hexToRgba;
//# sourceMappingURL=hex-to-rgba.js.map