bug fixed

This commit is contained in:
pqcqaq 2024-07-18 12:25:31 +08:00
parent b725a559f7
commit 439d21e3e6
1 changed files with 4 additions and 4 deletions

View File

@ -336,14 +336,14 @@ export const createLightTheme = (themeVariables: ThemeVariables) => {
if (themeLightId) { if (themeLightId) {
document.getElementById(themeLightId)?.remove(); document.getElementById(themeLightId)?.remove();
} }
return createTheme(themeMap.light, themeVariables); themeLightId = createTheme(themeMap.light, themeVariables);
}; };
export const createDarkTheme = (themeVariables: ThemeVariables) => { export const createDarkTheme = (themeVariables: ThemeVariables) => {
if (themeDarkId) { if (themeDarkId) {
document.getElementById(themeDarkId)?.remove(); document.getElementById(themeDarkId)?.remove();
} }
return createTheme(themeMap.dark, themeVariables); themeDarkId = createTheme(themeMap.dark, themeVariables);
}; };
export const getColorAsync = async () => { export const getColorAsync = async () => {
@ -361,8 +361,8 @@ let themeLightId: string | null = null;
let themeDarkId: string | null = null; let themeDarkId: string | null = null;
getColorAsync().then((color) => { getColorAsync().then((color) => {
themeLightId = createLightTheme(color.onLight); createLightTheme(color.onLight);
themeDarkId = createDarkTheme(color.onDark!); createDarkTheme(color.onDark!);
}); });
// 在退出的时候删除这两个主题,防止重复加载 // 在退出的时候删除这两个主题,防止重复加载