UNPKG

@drivy/cobalt

Version:

Opinionated design system for Drivy's projects.

19 lines (18 loc) 721 B
const getCSSVariableThemeColor = (colorThemeName)=>`var(--c-${colorThemeName})`; const getComputedThemeColor = (colorThemeName)=>{ if ("current" === colorThemeName) return "currentColor"; if ("transparent" === colorThemeName) return "transparent"; const styles = getComputedStyle(document.documentElement); return styles.getPropertyValue(`--c-${colorThemeName}`); }; const getA11yOnClick = (onClick)=>({ onClick, onKeyUp: (e)=>{ if ("Enter" === e.key || " " === e.key) { e.preventDefault(); onClick(e); } } }); export { getA11yOnClick, getCSSVariableThemeColor, getComputedThemeColor }; //# sourceMappingURL=index.js.map