diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 1974679..07671a0 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -50,28 +50,56 @@ export default function RootLayout({ return (
+ diff --git a/src/components/SettingsPage.tsx b/src/components/SettingsPage.tsx index f1a4eb4..3146f9c 100644 --- a/src/components/SettingsPage.tsx +++ b/src/components/SettingsPage.tsx @@ -25,29 +25,41 @@ export default function SettingsPage({ userEmail }: SettingsPageProps) { }, []); const handleThemeChange = (newTheme: string) => { - console.log('Changing theme to:', newTheme); - setCurrentTheme(newTheme); localStorage.setItem('theme-mode', newTheme); const html = document.documentElement; + const body = document.body; if (newTheme === 'dark') { - html.classList.add('dark'); + html.classList.add('dark-mode', 'dark'); html.style.colorScheme = 'dark'; + body.style.backgroundColor = '#0f172a'; + body.style.color = '#f1f5f9'; + document.querySelectorAll('[class*="bg-"]').forEach(el => { + if (el.classList.toString().includes('bg-slate') || el.classList.toString().includes('bg-white')) { + el.style.backgroundColor = ''; + } + }); toast.success('🌙 Switched to dark theme'); } else if (newTheme === 'light') { - html.classList.remove('dark'); + html.classList.remove('dark-mode', 'dark'); html.style.colorScheme = 'light'; + body.style.backgroundColor = '#f8fafc'; + body.style.color = '#1e293b'; toast.success('☀️ Switched to light theme'); } else if (newTheme === 'system') { const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches; if (prefersDark) { - html.classList.add('dark'); + html.classList.add('dark-mode', 'dark'); html.style.colorScheme = 'dark'; + body.style.backgroundColor = '#0f172a'; + body.style.color = '#f1f5f9'; } else { - html.classList.remove('dark'); + html.classList.remove('dark-mode', 'dark'); html.style.colorScheme = 'light'; + body.style.backgroundColor = '#f8fafc'; + body.style.color = '#1e293b'; } toast.success('🔄 Using system preference'); }