make lightmode default

This commit is contained in:
2025-05-22 16:08:17 +03:00
parent 417f1d0004
commit f7ff263818
3 changed files with 62 additions and 63 deletions

View File

@@ -199,13 +199,13 @@ const body = document.body;
// Apply saved theme on load
document.addEventListener('DOMContentLoaded', () => {
const savedTheme = localStorage.getItem('theme') || 'light'; // Default is light mode
const savedTheme = localStorage.getItem('theme') || 'dark'; // Default is dark mode
if (savedTheme === 'light') {
body.classList.add('light-mode');
if (savedTheme === 'dark') {
body.classList.add('dark-mode');
toggleSwitch.checked = true;
} else {
body.classList.remove('light-mode');
body.classList.remove('dark-mode');
toggleSwitch.checked = false;
}
});
@@ -213,12 +213,11 @@ document.addEventListener('DOMContentLoaded', () => {
// Toggle between light and dark mode
toggleSwitch.addEventListener('change', () => {
if (toggleSwitch.checked) {
body.classList.add('light-mode');
localStorage.setItem('theme', 'light');
} else {
body.classList.remove('light-mode');
body.classList.add('dark-mode');
localStorage.setItem('theme', 'dark');
} else {
body.classList.remove('dark-mode');
localStorage.setItem('theme', 'light');
}
});