style(Tabbar): adjust text color

This commit is contained in:
chenjiahan
2022-01-27 11:19:32 +08:00
parent 8e98e97449
commit 39b51d5dae
6 changed files with 17 additions and 7 deletions

View File

@@ -75,7 +75,16 @@ export function syncThemeToChild(theme) {
}
export function getDefaultTheme() {
return window.localStorage.getItem('vantTheme') || 'light';
const cache = window.localStorage.getItem('vantTheme');
if (cache) {
return cache;
}
const useDark =
window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches;
return useDark ? 'dark' : 'light';
}
export function useCurrentTheme() {