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 d9baa2f commit 0a44ea7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions site/static/docs/5.3/assets/js/color-modes.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
}

const setTheme = theme => {
if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.documentElement.setAttribute('data-bs-theme', 'dark')
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 0a44ea7

Please sign in to comment.