Fix: Lieve modifica al codice per la dark-mode

main-old
Antonio De Lucreziis 3 years ago
parent 514973852c
commit 5d6d4bd4d4

@ -34,9 +34,8 @@
const $toggle = document.querySelector('#toggle-dark-mode'); const $toggle = document.querySelector('#toggle-dark-mode');
const $toggleIcon = document.querySelector('#toggle-dark-mode i'); const $toggleIcon = document.querySelector('#toggle-dark-mode i');
// Loads prefered dark from from localStorage or default to media query. // Loads prefered dark from from localStorage or defaults to media query.
let prefersDarkMode = localStorage.getItem('theme') === 'dark' let prefersDarkMode = localStorage.getItem('theme') !== undefined ? localStorage.getItem('theme') === 'dark' : window.matchMedia('(prefers-color-scheme: dark)').matches;
|| window.matchMedia('(prefers-color-scheme: dark)').matches;
function storePrefersDarkMode(mode) { function storePrefersDarkMode(mode) {
prefersDarkMode = mode; prefersDarkMode = mode;

Loading…
Cancel
Save