Skip to content

Commit

Permalink
Add dark theme logo
Browse files Browse the repository at this point in the history
  • Loading branch information
rmosolgo committed Jan 22, 2024
1 parent 722e6ed commit 53ccc37
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions guides/_layouts/default.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,17 @@
localStorage.setItem("prefersDarkScheme", "true")
}
}
console.log(toggle, prefersDarkSchemeSetting, prefersDarkScheme)

if (prefersDarkScheme) {
document.body.classList.add('dark-theme');
document.querySelectorAll(".graphql-ruby-img").forEach(function(el) {
el.src = "{{ site.baseurl }}/graphql-ruby-dark.png"
})
} else {
document.body.classList.remove('dark-theme');
document.querySelectorAll(".graphql-ruby-img").forEach(function(el) {
el.src = "{{ site.baseurl }}/graphql-ruby.png"
})
}
}

Expand All @@ -46,7 +51,7 @@
<div class="header-container">
<div class="nav">
<a href="{{ site.baseurl }}/" class="img-link">
<img src="{{ site.baseurl }}/graphql-ruby.png" alt="GraphQL Ruby Logo" />
<img class="graphql-ruby-img" src="{{ site.baseurl }}/graphql-ruby.png" alt="GraphQL Ruby Logo" />
</a>
<a href="{{ site.baseurl }}/getting_started">Get Started</a>
<a href="{{ site.baseurl }}/guides">Guides</a>
Expand All @@ -73,5 +78,8 @@
</div>
<script src="https://cdn.jsdelivr.net/algoliasearch/3/algoliasearchLite.min.js"></script>
<script src="{{ site.baseurl }}/js/search.js"></script>
<script>
detectDarkTheme(false) // do it again to update the images
</script>
</body>
</html>
2 changes: 1 addition & 1 deletion guides/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
---
<div class="hero">
<div class="hero-title">
<img src="{{ site.baseurl }}/graphql-ruby.png" alt="GraphQL Ruby Logo"/>
<img class="graphql-ruby-img" src="{{ site.baseurl }}/graphql-ruby.png" alt="GraphQL Ruby Logo"/>
<h1>GraphQL Ruby</h1>
</div>
<div class="hero-part shaded">
Expand Down

0 comments on commit 53ccc37

Please sign in to comment.