Skip to content

Commit

Permalink
Add darkmode ssp logo
Browse files Browse the repository at this point in the history
  • Loading branch information
heedongy committed Oct 10, 2024
1 parent ff8d036 commit be589e5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions _scripts/dark-mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,24 @@
// immediately load saved mode before page renders
document.documentElement.dataset.dark = loadDark();

const updateImages = () => {
const isDarkMode = document.documentElement.dataset.dark === "true";

const sspLogo = document.getElementById("ssp-logo");

if (sspLogo) {
sspLogo.src = isDarkMode
? "images/newSSPlogo_withstar_dark.png"
: "images/newSSPlogo_withstar.png";
}
};

const onLoad = () => {
// update toggle button to match loaded mode
document.querySelector(".dark-toggle").checked =
document.documentElement.dataset.dark === "true";

updateImages();
};

// after page loads
Expand All @@ -24,5 +38,6 @@
const value = event.target.checked;
document.documentElement.dataset.dark = value;
saveDark(value);
updateImages();
};
}
Binary file added images/newSSPlogo_withstar_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit be589e5

Please sign in to comment.