@fremtind/jkl-core
Version:
Jøkul core styles
16 lines (15 loc) • 501 B
JavaScript
const getThemeAndDensity = (element) => {
if (!element)
return {};
const computedStyles = getComputedStyle(element);
const theme = parseInt(
computedStyles.getPropertyValue("--jkl-background-color").replace("#", ""),
16
) < 16777215 / 2 ? "dark" : "light";
const density = computedStyles.getPropertyValue("--jkl-density") === '"compact"' ? "compact" : "comfortable";
return { theme, density };
};
export {
getThemeAndDensity
};
//# sourceMappingURL=getThemeAndDensity.js.map