From c15b88d40fef872baca7dcfde5cab9f2cf5c2ba4 Mon Sep 17 00:00:00 2001 From: Udit Padhan Date: Mon, 12 Dec 2022 20:11:41 +0530 Subject: [PATCH] dark theme added --- index.html | 1 + index.js | 15 +++++++++++++++ style.css | 14 ++++++++++++++ 3 files changed, 30 insertions(+) diff --git a/index.html b/index.html index c149619..e169e19 100644 --- a/index.html +++ b/index.html @@ -32,6 +32,7 @@ + diff --git a/index.js b/index.js index 10f0dda..aca44d4 100644 --- a/index.js +++ b/index.js @@ -658,3 +658,18 @@ window.addEventListener("load", function() { } }); + +function myFunction() { + const button = document.getElementById('dark'); + const toggle = document.getElementById('toggle'); + toggle.style.backgroundColor = "#EEEEEE"; + var element = document.body; + element.classList.toggle("dark-mode"); + if(button.innerHTML === "Light Mode") { + button.innerHTML = "Dark Mode"; + } + else if(button.innerHTML === "Dark Mode") { + button.innerHTML = "Light Mode"; + } +} + diff --git a/style.css b/style.css index 258ecfb..1ca79da 100644 --- a/style.css +++ b/style.css @@ -180,3 +180,17 @@ a#toggle:hover { color: rgb(219, 68, 55); font-size: 2em; } + +#dark { + position:fixed; + left: 1px; + top: 1px; + width: 80px; + height: 35px; + font-size: smaller; +} + +.dark-mode { + background-color: #000000c4; + color: white; +} \ No newline at end of file