Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -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");

Expand Down
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ <h2>A listing of movies, TV shows and musicals as emojis. πŸ’–</h2>
<p>Want to add to EmojiScreen? Head to Github! ✨</p>
<a href="https://github.com/brittanyrw/emojiscreen" target="_blank">Contribute</a>
</div>

<button id="theme-toggle" aria-label="Toggle Light/Dark Mode">πŸŒ™</button>

</div>
</header>
<section id="filters">
Expand Down
14 changes: 13 additions & 1 deletion main.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -467,4 +479,4 @@ footer a {

#secret-code .emoji-img:nth-child(4n) {
animation-timing-function: ease-out;
}
}