We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
color-modes.js
1 parent 8a867ee commit 4e4a378Copy full SHA for 4e4a378
color-modes/js/color-modes.js
@@ -20,8 +20,8 @@
20
}
21
22
const setTheme = theme => {
23
- if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
24
- 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'))
25
} else {
26
document.documentElement.setAttribute('data-bs-theme', theme)
27
0 commit comments