feat: set dark-mode default
This commit is contained in:
parent
fc56fecdb5
commit
4183f254d2
@ -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);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user