Follow system theme

This commit is contained in:
krek0 2026-04-22 09:28:58 +02:00
parent 70e825efda
commit 0c42aa321d
4 changed files with 17 additions and 3 deletions

View file

@ -6,7 +6,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
/* Use dark scrollbar */
:root {
color-scheme: dark;
color-scheme: light dark;
}
/* Bootstrap icons */

13
photo21/static/theme.js Normal file
View file

@ -0,0 +1,13 @@
/*
This file is part of photo21
Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay
SPDX-License-Identifier: GPL-3.0-or-later
*/
(function() {
var mq = window.matchMedia('(prefers-color-scheme: dark)');
document.documentElement.setAttribute('data-bs-theme', mq.matches ? 'dark' : 'light');
mq.addEventListener('change', function(e) {
document.documentElement.setAttribute('data-bs-theme', e.matches ? 'dark' : 'light');
});
})();