1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-26 06:44:35 +02:00

Merge branch 'main' into main-lmp-contextual-theme-switcher

This commit is contained in:
Louis-Maxime Piton
2024-07-23 09:18:00 +02:00
330 changed files with 5460 additions and 12414 deletions

View File

@@ -1,6 +1,6 @@
/*!
* Color mode toggler for Bootstrap's docs (https://getbootstrap.com/)
* Copyright 2011-2023 The Bootstrap Authors
* Copyright 2011-2024 The Bootstrap Authors
* Licensed under the Creative Commons Attribution 3.0 Unported License.
*/
@@ -20,8 +20,8 @@
}
const setTheme = (theme, element = document.documentElement) => {
if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
element.setAttribute('data-bs-theme', 'dark')
if (theme === 'auto') {
element.setAttribute('data-bs-theme', (window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'))
} else {
element.setAttribute('data-bs-theme', theme)
}