From 710a0b0c78349837ed66229c225d087e8656d530 Mon Sep 17 00:00:00 2001 From: Code Hangen <111701513+codehangen@users.noreply.github.com> Date: Wed, 14 Dec 2022 22:43:00 -0300 Subject: [PATCH] Update modeTheme.js --- modeTheme.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/modeTheme.js b/modeTheme.js index 072944c..2e2fd4a 100644 --- a/modeTheme.js +++ b/modeTheme.js @@ -1,10 +1,14 @@ -function modeTheme() { +// license: https://www.w3schools.com/howto/howto_js_toggle_dark_mode.asp +function darkTheme() { var element = document.body; element.classList.toggle("dark-mode"); - document.getElementById("btn1").style.color = "white"; - document.getElementById("btn2").style.color = "white"; - document.getElementById("btn3").style.color = "white"; - document.getElementById("btn4").style.color = "white"; - document.getElementById("btn5").style.color = "white"; - document.getElementById("btn6").style.color = "white"; + var button = document.querySelector("button") + button.classList.add("dark-modeBtn") +} + +function lightTheme() { + var body = document.querySelector("body") + body.classList.remove("dark-mode") + var button = document.querySelector("button") + button.classList.remove("dark-modeBtn") }