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:
@@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user