Skip to content

Commit 53ccc37

Browse files
committed
Add dark theme logo
1 parent 722e6ed commit 53ccc37

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

guides/_layouts/default.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,17 @@
3131
localStorage.setItem("prefersDarkScheme", "true")
3232
}
3333
}
34-
console.log(toggle, prefersDarkSchemeSetting, prefersDarkScheme)
3534

3635
if (prefersDarkScheme) {
3736
document.body.classList.add('dark-theme');
37+
document.querySelectorAll(".graphql-ruby-img").forEach(function(el) {
38+
el.src = "{{ site.baseurl }}/graphql-ruby-dark.png"
39+
})
3840
} else {
3941
document.body.classList.remove('dark-theme');
42+
document.querySelectorAll(".graphql-ruby-img").forEach(function(el) {
43+
el.src = "{{ site.baseurl }}/graphql-ruby.png"
44+
})
4045
}
4146
}
4247

@@ -46,7 +51,7 @@
4651
<div class="header-container">
4752
<div class="nav">
4853
<a href="{{ site.baseurl }}/" class="img-link">
49-
<img src="{{ site.baseurl }}/graphql-ruby.png" alt="GraphQL Ruby Logo" />
54+
<img class="graphql-ruby-img" src="{{ site.baseurl }}/graphql-ruby.png" alt="GraphQL Ruby Logo" />
5055
</a>
5156
<a href="{{ site.baseurl }}/getting_started">Get Started</a>
5257
<a href="{{ site.baseurl }}/guides">Guides</a>
@@ -73,5 +78,8 @@
7378
</div>
7479
<script src="https://cdn.jsdelivr.net/algoliasearch/3/algoliasearchLite.min.js"></script>
7580
<script src="{{ site.baseurl }}/js/search.js"></script>
81+
<script>
82+
detectDarkTheme(false) // do it again to update the images
83+
</script>
7684
</body>
7785
</html>

guides/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
---
44
<div class="hero">
55
<div class="hero-title">
6-
<img src="{{ site.baseurl }}/graphql-ruby.png" alt="GraphQL Ruby Logo"/>
6+
<img class="graphql-ruby-img" src="{{ site.baseurl }}/graphql-ruby.png" alt="GraphQL Ruby Logo"/>
77
<h1>GraphQL Ruby</h1>
88
</div>
99
<div class="hero-part shaded">

0 commit comments

Comments
 (0)