Skip to content

Instantly share code, notes, and snippets.

@curiositry
Last active July 28, 2021 23:28
Show Gist options
  • Select an option

  • Save curiositry/f6dc4ea47a9ef27fda162ab226e28b68 to your computer and use it in GitHub Desktop.

Select an option

Save curiositry/f6dc4ea47a9ef27fda162ab226e28b68 to your computer and use it in GitHub Desktop.
Weblog Dark Mode Toggle
/*
Either put this at the end of main.css (to add dark mode toggle in addition to auto-detecting
users preference) or else replace from lines 282-297 of main.css with this snippet
*/
body.dark-theme {
background: #333;
color: #fdfdfd;
}
.dark-theme a {
color: lightblue;
}
.dark-theme .kg-bookmark-container {
background-color: #444;
}
<button onclick="document.body.classList.toggle('dark-theme')">Toggle Dark Mode</button>
<!-- or -->
<a href="#!" onclick="document.body.classList.toggle('dark-theme')">Toggle Dark Mode</a>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment