1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 16:29:17 +08:00

fix: the issue where the auto theme is invalid due to an incorrect class setting (#5194)

This commit is contained in:
Takagi 2024-05-29 14:26:20 +08:00 committed by GitHub
parent 8fc708be97
commit 409e90d2c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,6 +32,9 @@ export const useTheme = () => {
};
const updateTheme = (theme: string) => {
if (theme === 'auto') {
theme = prefersDark.matches ? 'dark' : 'light';
}
const body = document.documentElement as HTMLElement;
body.setAttribute('class', theme);
};