From 6578e598fe27ffda073e2a37295707bcad3c7fba Mon Sep 17 00:00:00 2001 From: Nwamini Emmanuel Onyedikachi Date: Sun, 22 Oct 2023 16:50:37 +0100 Subject: [PATCH 1/3] Update app.js adding dark mode --- app.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app.js b/app.js index 97c1b943..a4a70642 100644 --- a/app.js +++ b/app.js @@ -1,4 +1,23 @@ $(document).ready(function() { + + + const themeToggle = document.getElementById("theme-toggle"); +const body = document.body; + +function toggleTheme() { + body.classList.toggle("dark-mode"); + const isDarkMode = body.classList.contains("dark-mode"); + localStorage.setItem("theme", isDarkMode ? "dark" : "light"); +} + +themeToggle.addEventListener("click", toggleTheme); + +const savedTheme = localStorage.getItem("theme"); +if (savedTheme === "dark") { + body.classList.add("dark-mode"); +} + + // Create a variable for the container to hold the emoji cards. const emojiCardContainer = document.getElementById("emojis"); From 93966bbaf7d28d3ad5dff65280eb074d4b5ecf1a Mon Sep 17 00:00:00 2001 From: Nwamini Emmanuel Onyedikachi Date: Sun, 22 Oct 2023 16:54:36 +0100 Subject: [PATCH 2/3] Update index.html adding the button --- index.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/index.html b/index.html index cd27842d..906c5f50 100644 --- a/index.html +++ b/index.html @@ -47,6 +47,9 @@

A listing of movies, TV shows and musicals as emojis. 💖

Want to add to EmojiScreen? Head to Github! ✨

Contribute + + +
From 7b3849e3bda2f7bfb48e72e5eeff1b4e6e269d9f Mon Sep 17 00:00:00 2001 From: Nwamini Emmanuel Onyedikachi Date: Sun, 22 Oct 2023 16:57:01 +0100 Subject: [PATCH 3/3] Update main.css updating the css --- main.css | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/main.css b/main.css index 55ad5a34..21cf8df8 100755 --- a/main.css +++ b/main.css @@ -9,6 +9,18 @@ body { margin: 0; } +:root { + --background-light: #ffffff; + --text-light: #000000; + /* Define other light mode variables */ +} + +.dark-mode { + --background: #1a1a1a; + --text: #ffffff; + /* Define other dark mode variables */ +} + header { max-width: 1200px; margin: 0 auto; @@ -467,4 +479,4 @@ footer a { #secret-code .emoji-img:nth-child(4n) { animation-timing-function: ease-out; -} \ No newline at end of file +}