This commit is contained in:
@@ -169,6 +169,9 @@ export const initSystemThemeListener = (appService: AppService) => {
|
||||
} else {
|
||||
systemIsDarkMode = mediaQuery.matches;
|
||||
}
|
||||
if (typeof window !== 'undefined' && localStorage) {
|
||||
localStorage.setItem('systemIsDarkMode', systemIsDarkMode ? 'true' : 'false');
|
||||
}
|
||||
useThemeStore.getState().handleSystemThemeChange(systemIsDarkMode);
|
||||
};
|
||||
|
||||
|
||||
@@ -553,8 +553,8 @@ export const getThemeCode = () => {
|
||||
if (typeof window !== 'undefined') {
|
||||
themeColor = localStorage.getItem('themeColor') || 'default';
|
||||
themeMode = localStorage.getItem('themeMode') || 'auto';
|
||||
systemIsDarkMode = localStorage.getItem('systemIsDarkMode') === 'true';
|
||||
customThemes = JSON.parse(localStorage.getItem('customThemes') || '[]');
|
||||
systemIsDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
}
|
||||
const isDarkMode = themeMode === 'dark' || (themeMode === 'auto' && systemIsDarkMode);
|
||||
let currentTheme = themes.find((theme) => theme.name === themeColor);
|
||||
|
||||
Reference in New Issue
Block a user