Skip to content

Commit

Permalink
Addressing the dark mode flicker issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxim Shelepov committed Dec 13, 2023
1 parent 392ee7e commit 693f44d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/views/MainView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ const landingTransition = () => {
const useDark = () => {
// credit: https://tailwindcss.com/docs/dark-mode#supporting-system-preference-and-manual-selection
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark')
document.documentElement.classList.remove('bg-white')
document.documentElement.classList.add('dark', 'bg-slate-900')
darkModeActive.value = true
} else {
document.documentElement.classList.remove('dark')
document.documentElement.classList.remove('dark', 'bg-slate-900')
document.documentElement.classList.add('bg-white')
darkModeActive.value = false
}
Expand Down

0 comments on commit 693f44d

Please sign in to comment.