@drivy/cobalt
Version:
Opinionated design system for Drivy's projects.
24 lines (22 loc) • 731 B
JavaScript
const getCSSVariableThemeColor = (colorThemeName) => {
return `var(--c-${colorThemeName})`;
};
const getComputedThemeColor = (colorThemeName) => {
if (colorThemeName === "current")
return "currentColor";
if (colorThemeName === "transparent")
return "transparent";
const styles = getComputedStyle(document.documentElement);
return styles.getPropertyValue(`--c-${colorThemeName}`);
};
const getA11yOnClick = (onClick) => ({
onClick,
onKeyUp: (e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
onClick(e);
}
},
});
export { getA11yOnClick, getCSSVariableThemeColor, getComputedThemeColor };
//# sourceMappingURL=index.js.map