2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-11 18:02:28 +03:00

Fix color-mode.js

This commit is contained in:
MewenLeHo
2023-09-22 14:31:53 +02:00
committed by Mark Otto
parent d769ae0e0f
commit 73e1dcf43e
@@ -20,8 +20,8 @@
} }
const setTheme = theme => { const setTheme = theme => {
if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) { if (theme === 'auto') {
document.documentElement.setAttribute('data-bs-theme', 'dark') document.documentElement.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'))
} else { } else {
document.documentElement.setAttribute('data-bs-theme', theme) document.documentElement.setAttribute('data-bs-theme', theme)
} }