/* theme file for react-jss */ const theme = {}; const themeChange = { listeners: [], subscribe: cb => themeChange.listeners.push(cb) } const isDark = window.matchMedia('(prefers-color-scheme: dark)'); isDark.addListener(evt=>{ if(evt.matches) theme.colorPrimary = 'yellow'; else theme.colorPrimary = 'red'; themeChange.listeners.forEach(handler => handler(evt.matches?'dark':'light')) }); if(isDark.matches) theme.colorPrimary = 'yellow'; else theme.colorPrimary = 'red'; export { theme as default, themeChange }