Skip to content

Commit

Permalink
Fix color-mode.js
Browse files Browse the repository at this point in the history
  • Loading branch information
MewenLeHo committed Sep 22, 2023
1 parent 005d35b commit 28d92c1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions site/static/docs/5.3/assets/js/color-modes.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
}

const setTheme = theme => {
if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.documentElement.setAttribute('data-bs-theme', 'dark')
} else {
if (theme === 'auto') {
document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'))
} else {
document.documentElement.setAttribute('data-bs-theme', theme)
}
}

Expand Down

0 comments on commit 28d92c1

Please sign in to comment.