mirror of
https://github.com/KazooTTT/kazoottt-blog.git
synced 2025-06-23 02:31:33 +08:00
Resolved dark mode bug
This commit is contained in:
@ -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
|
||||||
|
Reference in New Issue
Block a user