@syncognito/maya
Version:
Maya Design System - Shared tokens and platform-specific components
29 lines • 982 B
JavaScript
// Maya Theme Utilities
// Theme utilities
export const setMayaTheme = (theme) => {
document.documentElement.setAttribute('data-maya-theme', theme);
};
export const getMayaTheme = () => {
return (document.documentElement.getAttribute('data-maya-theme') ||
'day');
};
export const detectSystemTheme = () => {
if (typeof window === 'undefined')
return 'day';
const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
const isEvening = window.matchMedia('(prefers-color-scheme: light)').matches &&
new Date().getHours() >= 17; // Evening after 5 PM
if (isEvening)
return 'evening';
if (isDark)
return 'night';
return 'day';
};
// Auto-detect and set system theme
export const initMayaTheme = () => {
const systemTheme = detectSystemTheme();
setMayaTheme(systemTheme);
};
// Export mobile-specific variables
export { mayaColors } from './variables.mobile';
//# sourceMappingURL=index.js.map