Skip to content

Commit

Permalink
Fix edge case in color-modes.js (#1854)
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-deramond committed Jan 9, 2024
1 parent be3d699 commit 757f5b0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/assets/js/color-modes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,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 757f5b0

Please sign in to comment.