koval-ui
Version:
React components collection with minimalistic design. Supports theming, layout, and input validation.
15 lines (14 loc) • 496 B
JavaScript
"use client";
const l = (r, i) => {
if (r) {
if (r.startsWith("#") && (r = r.slice(1)), r.length === 3 && (r = r[0] + r[0] + r[1] + r[1] + r[2] + r[2]), r.length !== 6)
throw new Error("Invalid HEX color.");
const t = parseInt(r.slice(0, 2), 16), n = parseInt(r.slice(2, 4), 16), s = parseInt(r.slice(4, 6), 16);
return t * 0.299 + n * 0.587 + s * 0.114 > 186 ? "#000000" : "#FFFFFF";
}
return "";
};
export {
l as invertColor
};
//# sourceMappingURL=invertColor.js.map