Follow system theme
This commit is contained in:
parent
70e825efda
commit
0c42aa321d
4 changed files with 17 additions and 3 deletions
13
photo21/static/theme.js
Normal file
13
photo21/static/theme.js
Normal 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');
|
||||
});
|
||||
})();
|
||||
Loading…
Add table
Add a link
Reference in a new issue