Skip to content

Commit

Permalink
Added dark mode support with a checkbox
Browse files Browse the repository at this point in the history
I added a checkbox with for enabling and disabling dark mode and added the functionality. Of course, dark colors, position of the checkbox can all be improved but focused more on the functionality itself and hopefully its gets accepted.
  • Loading branch information
karimk123 committed Dec 17, 2020
1 parent 35ed8e8 commit ad1ed5f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,29 @@
<div style="margin-top: 5px">
<a href="https://mechvibes.com" class="open-in-browser">Check it out</a>
</div>
<!-- PART FOR DARK MODE CHECKBOX-->
<input type="checkbox" id="theme-checkbox"> Dark Mode</input>
</div>
</div>
</div>
</body>
</html>

<script>
//javascript for dark mode checkbox
let themeCheck = document.getElementById("theme-checkbox");
if(themeCheck.enabled){
document.body.style.backgroundColor = "#0A0E12"; //dark mode color i picked but of course can be changed
document.body.style.color = "white";
}
else{

document.body.style.backgroundColor = "white"; //dark mode color i picked but of course can be changed
document.body.style.color = "black";

}

#All colors can be changed i just implented the functionality it self.

</script>
<!--END DARK MODE CHECKBOX-->

0 comments on commit ad1ed5f

Please sign in to comment.