Resolved dark mode bug

This commit is contained in:
srleom
2024-03-19 16:58:08 +08:00
parent 1b75e47281
commit 81915c0414

View File

@ -12,6 +12,8 @@
return console.log(`Invalid theme value '${newTheme}' received. Expected 'light' or 'dark'.`) return console.log(`Invalid theme value '${newTheme}' received. Expected 'light' or 'dark'.`)
} }
localStorage.setItem('theme', newTheme)
const root = document.documentElement const root = document.documentElement
// if current dark theme and new theme is dark, return // if current dark theme and new theme is dark, return
@ -22,8 +24,6 @@
} }
root.classList.toggle('dark') root.classList.toggle('dark')
localStorage.setItem('theme', newTheme)
} }
// Initial Setup // Initial Setup