]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Fix color-mode.js
authorMewenLeHo <mewen.leho.ext@orange.com>
Fri, 22 Sep 2023 12:31:53 +0000 (14:31 +0200)
committerMark Otto <markdotto@gmail.com>
Tue, 31 Oct 2023 16:42:15 +0000 (09:42 -0700)
site/static/docs/5.3/assets/js/color-modes.js

index 9f22daa1b286cd3e0eabf17085feb2ef0d99d392..31f22f9e4f88e74cd00e9cd276d3c2179c0c7a39 100644 (file)
@@ -20,8 +20,8 @@
   }
 
   const setTheme = theme => {
-    if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
-      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'))
     } else {
       document.documentElement.setAttribute('data-bs-theme', theme)
     }