„Darkmode.js“ löschen

master
Elias John 2 years ago
parent 22a791d451
commit b90f2e2018

@ -1,35 +0,0 @@
let darkmode = false ;
const BUTTON= Document.getElementbyId ('Switch ');
const Body = document.querySelector ('body') ;
if (window.matchMedia('(prefers-scheme:dark )').matches ) {
darkmode= true ;
} else{
darkmode= false;
}
console.log(darkmode);
const switchMode = () => {
darkmode = !darkmode;
setclassTobody();
}
const setclassTobody =() => {
if (darkmode){
Body.classList.remove('light');
Body.classList.add('dark');
}else{
Body.classList.add('light');
Body.classList.remove('dark');
}
} ;
BUTTON.addEventLister('click', switchMode );
setclassTobody;
Loading…
Cancel
Save