Skip to content

Commit

Permalink
Fix color-mode.js
Browse files Browse the repository at this point in the history
  • Loading branch information
MewenLeHo authored and mdo committed Oct 31, 2023
1 parent d769ae0 commit 73e1dcf
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 73e1dcf

Please sign in to comment.