Fix edge case in color-modes.js
For details, see https://github.com/twbs/bootstrap/pull/39224
This commit is contained in:
parent
cf6adbf80c
commit
f0d286179a
@ -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);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user