UNPKG

@syncognito/maya

Version:

Maya Design System - Shared tokens and platform-specific components

27 lines 897 B
// 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); }; //# sourceMappingURL=index.js.map