diff --git a/lib/src/Components/AppShell/hooks/useTheme.tsx b/lib/src/Components/AppShell/hooks/useTheme.tsx index 367d8fd3..cd85649b 100644 --- a/lib/src/Components/AppShell/hooks/useTheme.tsx +++ b/lib/src/Components/AppShell/hooks/useTheme.tsx @@ -5,8 +5,11 @@ export const useTheme = (defaultTheme = 'default') => { const savedTheme = localStorage.getItem('theme') const initialTheme = savedTheme ? (JSON.parse(savedTheme) as string) : defaultTheme if (initialTheme !== 'default') { - document.documentElement.setAttribute('data-theme', defaultTheme) + document.documentElement.setAttribute('data-theme', initialTheme) localStorage.setItem('theme', JSON.stringify(initialTheme)) + } else { + document.documentElement.removeAttribute('data-theme') + localStorage.removeItem('theme') } }, [defaultTheme]) }