Skip to content

Commit

Permalink
Merge pull request #88 from bitkarrot/master
Browse files Browse the repository at this point in the history
 add dark mode toggle
  • Loading branch information
willcl-ark authored Jan 10, 2025
2 parents f7c1c4e + 03473b2 commit c10c10e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ github_username: chaincodelabs

# Build settings
theme: just-the-docs
# Color scheme supports "light" and "dark"
color_scheme: dark
plugins:
- asciidoctor-diagram
- jekyll-feed
Expand Down
17 changes: 17 additions & 0 deletions _includes/head_custom.html
Original file line number Diff line number Diff line change
@@ -1,2 +1,19 @@
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/asciidoc.css">

<button class="btn js-toggle-dark-mode"><i class="fa fa-sun-o"></i></button>

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

jtd.addEvent(toggleDarkMode, 'click', function() {
if (jtd.getTheme() === 'dark') {
jtd.setTheme('light');
toggleIcon.className = 'fa fa-moon-o';
} else {
jtd.setTheme('dark');
toggleIcon.className = 'fa fa-sun-o';
}
});
</script>

0 comments on commit c10c10e

Please sign in to comment.