Skip to content

Commit

Permalink
Merge pull request #484 from jeevika17/darkmode
Browse files Browse the repository at this point in the history
the letters are more visible in darkmode #483
  • Loading branch information
tushargupta1504 authored Oct 18, 2024
2 parents 823c718 + 869adde commit 42d90da
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
21 changes: 21 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,24 @@ window.addEventListener('scroll', function(){
})


document.addEventListener('DOMContentLoaded',() => {
const darkToggle = document.getElementById('dark-change');

if(localStorage.getItem('darkMode') === 'enabled'){
document.body.classList.add('dark-mode');
darkToggle.classList.add('active');
}

darkToggle.addEventListener('click' , ()=>
{
document.body.classList.toggle('dark-mode');
darkToggle.classList.toggle('active');

if (document.body.classList.contains('dark-mode')){
localStorage.setItem('darkMode','enabled');
}
else{
localStorage.setItem('darkMode','disabled');
}
});
});
13 changes: 13 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,19 @@ footer h5 {

}

body.night .mb-2{
color: #000;
font-size: small;
text-align: left;
}

body.night .mb-0{
color: #000;
font-size: small;
text-align: left;
}


.bt1 {
background: url("img/feature-1.jpg") center/cover;
}
Expand Down

0 comments on commit 42d90da

Please sign in to comment.