diff --git a/index.html b/index.html
index 3bd4726..5997610 100644
--- a/index.html
+++ b/index.html
@@ -57,6 +57,7 @@
Candy Calc
+
FAQ
diff --git a/static/script.js b/static/script.js
index 3ee820c..263cf7c 100644
--- a/static/script.js
+++ b/static/script.js
@@ -241,3 +241,30 @@ $( document ).ready( function() {
} );
} )();
+
+//Darkmode toggle button
+var darkModeButton = document.getElementById("darkModeButton");
+if(darkModeButton) {
+ darkModeButton.addEventListener("click", function() {
+ document.body.classList.toggle("dark-mode");
+ var isDarkMode = document.body.classList.contains("dark-mode");
+ localStorage.setItem("darkMode", isDarkMode)
+
+ if(isDarkMode) {
+ darkModeButton.innerHTML = "Light Mode";
+ } else {
+ darkModeButton.innerHTML = "Dark Mode";
+ }
+ });
+}
+
+//Keeps dark mode between page loads
+window.addEventListener("load", function() {
+ var darkMode = this.localStorage.getItem("darkMode");
+ if(darkMode === "true") {
+ this.document.body.classList.add("dark-mode");
+ darkModeButton.innerHTML = "Light Mode";
+ } else {
+ darkModeButton.innerHTML = "Dark Mode";
+ }
+})
\ No newline at end of file
diff --git a/static/style.css b/static/style.css
index 0ee7b90..fe40aa4 100644
--- a/static/style.css
+++ b/static/style.css
@@ -383,3 +383,33 @@ footer {
margin-left: 8em
}
}
+
+.darkButton {
+ background-color: white;
+ cursor: pointer;
+ display: block;
+ margin: 0 auto;
+}
+
+.dark-mode,
+.dark-mode .darkButton,
+.dark-mode a {
+ background-color: #313131;
+ color: white;
+}
+
+.dark-mode #faq tbody tr:nth-of-type(2n+1) {
+ background: #222222
+}
+
+.dark-mode #calc, .dark-mode #calc a{
+ color: black;
+}
+
+.dark-mode #calc a {
+ background-color: #dc6a9d;
+}
+
+.dark-mode #faq h2 {
+ background-color: #222222;
+}
\ No newline at end of file