UNPKG

@fremtind/jkl-core

Version:
16 lines (15 loc) 501 B
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