From f0d286179a51ca55a69e551f788b6d6a4bea422a Mon Sep 17 00:00:00 2001 From: Aaron van Geffen Date: Wed, 21 Feb 2024 15:45:27 +0100 Subject: [PATCH] Fix edge case in color-modes.js For details, see https://github.com/twbs/bootstrap/pull/39224 --- public/js/color-modes.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/js/color-modes.js b/public/js/color-modes.js index b9167809..69dd9103 100644 --- a/public/js/color-modes.js +++ b/public/js/color-modes.js @@ -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); }