@serendie/ui
Version:
Adaptive UI component library as part of Serendie Design System by Mitsubishi Electric
13 lines (12 loc) • 614 B
JavaScript
import { token as s } from "../styled-system/tokens/index.js";
const l = (t) => {
if (t.startsWith("var(") && t.endsWith(")")) {
const c = t.replace("var(", "").replace(")", "");
t = getComputedStyle(document.documentElement).getPropertyValue(c);
}
const e = t.replace("#", ""), r = parseInt(e.substr(0, 2), 16), o = parseInt(e.substr(2, 2), 16), n = parseInt(e.substr(4, 2), 16);
return (r * 299 + o * 587 + n * 114) / 1e3 >= 128 ? s("colors.sd.system.color.chart.component.onMarkLabel") : s("colors.sd.system.color.chart.component.inverseOnMarkLabel");
};
export {
l as getContrastTextColor
};