Skip to content

Commit

Permalink
fix theme toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
KorigamiK committed Aug 6, 2023
1 parent b5a2e10 commit 69c18b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
12 changes: 4 additions & 8 deletions themes/ossn-theme/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,10 @@

function savePreferredColorScheme(scheme){
let systemScheme = 'light';

if (window.matchMedia('(prefers-color-scheme: dark)').matches)
systemScheme = 'dark';

if (systemScheme === scheme)
localStorage.removeItem("scheme");
else
localStorage.setItem("scheme", scheme);
systemScheme = 'dark';
if (systemScheme === scheme) localStorage.removeItem("scheme");
else localStorage.setItem("scheme", scheme);

}

Expand All @@ -122,7 +118,7 @@

function applyPreferredColorScheme(scheme) {
for (var s = 0; s < document.styleSheets.length; s++) {
if (document.styleSheets[s].href.startsWith("https://giscus.app")) continue;
if (document.styleSheets[s]?.href.startsWith("https://giscus.app")) continue;
for (var i = 0; i < document.styleSheets[s].cssRules.length; i++) {
rule = document.styleSheets[s].cssRules[i];
if (rule && rule.media && rule.media.mediaText.includes("prefers-color-scheme")) {
Expand Down
3 changes: 0 additions & 3 deletions themes/ossn-theme/layouts/partials/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
<span>{{ .Site.Params.footnote | safeHTML }}</span>
</div>




<div>
<span>&copy; {{ .Site.Params.since }}</span> -
<span>{{ now.Format "2006"}}</span>
Expand Down

0 comments on commit 69c18b9

Please sign in to comment.