native-variants
Version:
A library for handling variants in React Native components with theme support.
13 lines • 413 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.alpha = alpha;
function alpha(hex, opacity) {
if (!/^#([0-9a-f]{6})$/i.test(hex)) {
throw new Error("Hex color must be in the format #RRGGBB.");
}
const alpha = Math.round((opacity / 100) * 255)
.toString(16)
.padStart(2, "0");
return `${hex}${alpha}`;
}
//# sourceMappingURL=alpha.js.map