Skip to content

Commit

Permalink
docs: Add dark theme and ability to switch between light (#101)
Browse files Browse the repository at this point in the history
Added toggling between themes and set dark by default. 

**Note:** In dark mode logo logs a bit off. Not sure where it was
created, but we could add a white outline to the text or just have an
alt white text version of a logo.
  • Loading branch information
eng1n88r committed May 1, 2024
2 parents 04e6496 + 4b696db commit 239301c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/_config.yml
Expand Up @@ -4,6 +4,7 @@ theme: just-the-docs
url: https://basedhardware.github.io
logo: "/images/logo.png"
favicon_ico: "/images/favicon.ico"
color_scheme: dark

collections:
get_started:
Expand Down
15 changes: 15 additions & 0 deletions docs/_includes/header_custom.html
@@ -0,0 +1,15 @@
<button class="btn js-toggle-dark-mode"></button>

<script>
const toggleDarkMode = document.querySelector(".js-toggle-dark-mode");

jtd.addEvent(toggleDarkMode, "click", function () {
if (jtd.getTheme() === "light") {
jtd.setTheme("dark");
toggleDarkMode.textContent = "☼";
} else {
jtd.setTheme("light");
toggleDarkMode.textContent = "☾";
}
});
</script>

0 comments on commit 239301c

Please sign in to comment.