Dark mode fix

pull/1/head
Swissky 2022-09-30 17:03:34 +02:00
parent dfc3ed0d30
commit 9f9688a734
3 changed files with 4 additions and 8 deletions

View File

@ -39,8 +39,8 @@ footer-links:
# You can find your shortname on the Settings page of your Disqus account # You can find your shortname on the Settings page of your Disqus account
disqus: disqus:
# Enter your Google Analytics web tracking code (e.g. UA-2110908-2) to activate tracking # Enter your Google Analytics web tracking code (e.g. UA-2110908-2) to activate tracking, old: UA-109333953-1
google_analytics: UA-109333953-1 google_analytics:
# Your website URL (e.g. http://barryclark.github.io or http://www.barryclark.co) # Your website URL (e.g. http://barryclark.github.io or http://www.barryclark.co)
# Used for Sitemap.xml and your RSS feed # Used for Sitemap.xml and your RSS feed

View File

@ -5,11 +5,7 @@
function darkmode() { function darkmode() {
let enabled = localStorage.getItem('dark-mode') let enabled = localStorage.getItem('dark-mode')
if (enabled === null) { if (enabled === null || enabled === 'true') {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
enable();
}
} else if (enabled === 'true') {
enable() enable()
} }

View File

@ -26,6 +26,7 @@
<div class="site-info"> <div class="site-info">
<h1 class="site-name"><a href="{{ site.baseurl }}/">{{ site.name }}</a></h1> <h1 class="site-name"><a href="{{ site.baseurl }}/">{{ site.name }}</a></h1>
<p class="site-description">{{ site.description }}</p> <p class="site-description">{{ site.description }}</p>
<a class="dark-mode-button" >🌗</a>
</div> </div>
<nav> <nav>
@ -34,7 +35,6 @@
<a href="https://swisskyrepo.github.io/PayloadsAllTheThingsWeb/">📖PayloadsAllTheThings</a> <a href="https://swisskyrepo.github.io/PayloadsAllTheThingsWeb/">📖PayloadsAllTheThings</a>
<a href="https://swisskyrepo.github.io/HardwareAllTheThings/">🖥HardwareAllTheThings</a> <a href="https://swisskyrepo.github.io/HardwareAllTheThings/">🖥HardwareAllTheThings</a>
<a href="{{ site.baseurl }}/about">👤About</a> <a href="{{ site.baseurl }}/about">👤About</a>
<a class="dark-mode-button" >🌗 Dark mode</a>
</nav> </nav>
{% include dark-mode.html %} {% include dark-mode.html %}