mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-16 11:41:17 +02:00
Merge branch 'fix-theme-logic'
This commit is contained in:
commit
2dd5410300
9 changed files with 12 additions and 10 deletions
|
@ -110,8 +110,10 @@ function isCurrentDark() {
|
|||
const currentTheme = localStorage.getItem('theme')
|
||||
if (currentTheme)
|
||||
return currentTheme === 'dark'
|
||||
if (defaultMode)
|
||||
return defaultMode === 'dark'
|
||||
if (defaultMode === 'light')
|
||||
return false
|
||||
if (defaultMode === 'dark')
|
||||
return true
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue