From c7b220f30d194076be0bd11e4b49ac4e198b8dab Mon Sep 17 00:00:00 2001 From: Thomas Chartron Date: Sat, 6 Nov 2021 12:51:33 +0100 Subject: [PATCH] update --- static/js/main.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/static/js/main.js b/static/js/main.js index b92a3e2..0f6ef87 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -11,8 +11,10 @@ document.addEventListener("DOMContentLoaded", function() { // On page load or when changing themes, best to add inline in `head` to avoid FOUC if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) { document.documentElement.classList.add('dark') + document.getElementById('light').add('hidden'); } else { document.documentElement.classList.remove('dark') + document.getElementById('dark').add('hidden'); } // Switch theme action document.getElementById('switch-theme').addEventListener('click', switchTheme); @@ -29,7 +31,7 @@ function switchTheme() { } else { localStorage.theme = 'dark'; document.documentElement.classList.add('dark'); - document.getElementById('light').remove('hidden'); - document.getElementById('dark').add('hidden'); + document.getElementById('light').add('hidden'); + document.getElementById('dark').remove('hidden'); } }