From 4183f254d237602afd042cceec5dc7755f1b41e4 Mon Sep 17 00:00:00 2001 From: Matthew McKinnon Date: Sun, 15 Sep 2024 13:51:30 +1000 Subject: [PATCH] feat: set dark-mode default --- src/js/darkmode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/darkmode.js b/src/js/darkmode.js index b6a56b7..31bf8c2 100644 --- a/src/js/darkmode.js +++ b/src/js/darkmode.js @@ -1,7 +1,7 @@ // script.js document.addEventListener('DOMContentLoaded', () => { const switcher = document.getElementById('modeSwitcher'); - const currentMode = localStorage.getItem('theme') || 'light'; + const currentMode = localStorage.getItem('theme') || 'dark'; if (currentMode === 'dark') { document.body.classList.add('dark-mode'); @@ -10,7 +10,7 @@ document.addEventListener('DOMContentLoaded', () => { switcher.addEventListener('click', () => { document.body.classList.toggle('dark-mode'); - const mode = document.body.classList.contains('dark-mode') ? 'dark' : 'light'; + const mode = document.body.classList.contains('dark-mode') ? 'light' : 'dark'; // switcher.textContent = mode === 'dark' ? 'Switch to Light Mode' : 'Switch to Dark Mode'; localStorage.setItem('theme', mode); });