-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'seperate' of https://github.com/nishant0708/awesome-git…
…hub-profiles into minimal_items
- Loading branch information
Showing
3 changed files
with
31 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
document.addEventListener("DOMContentLoaded", function () { | ||
const themeToggleCheckbox = document.querySelector("#theme-toggle"); | ||
const themeLabel = document.querySelector(".toggle-label"); | ||
|
||
// Function to set the theme | ||
function setTheme(theme) { | ||
if (theme === "dark") { | ||
document.body.classList.add("dark-mode"); | ||
themeLabel.textContent = "Dark Mode"; | ||
themeToggleCheckbox.checked = true; | ||
} else { | ||
document.body.classList.remove("dark-mode"); | ||
themeLabel.textContent = "Light Mode"; | ||
themeToggleCheckbox.checked = false; | ||
} | ||
localStorage.setItem("theme", theme); | ||
} | ||
|
||
// Load the theme from localStorage | ||
const savedTheme = localStorage.getItem("theme") || "light"; | ||
setTheme(savedTheme); | ||
|
||
// Add event listener to toggle checkbox | ||
themeToggleCheckbox.addEventListener("change", () => { | ||
const newTheme = themeToggleCheckbox.checked ? "dark" : "light"; | ||
setTheme(newTheme); | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters