From 98d205ddae6d9ecab09c87081c256e60d23288cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Galv=C3=A3o?= Date: Sat, 20 Jan 2024 17:28:16 -0300 Subject: [PATCH] update togglemode --- script.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/script.js b/script.js index cfa3ff9..49102d1 100644 --- a/script.js +++ b/script.js @@ -1,5 +1,6 @@ function toggleMode() { const html = document.documentElement; + const root = document.querySelector(":root"); html.classList.toggle("light"); @@ -8,8 +9,10 @@ function toggleMode() { if (html.classList.contains("light")) { img.setAttribute("src", "./assets/avatar-light.png"); img.setAttribute("alt", "Light theme profile picture"); + root.style.setProperty("--bg-color", "rgb(239, 235, 239)"); } else { img.setAttribute("src", "./assets/avatar-dark.png"); img.setAttribute("alt", "Dark theme profile picture"); + root.style.setProperty("--bg-color", "rgb(22, 22, 24)"); } }