Merge pull request #2 from noelleleigh/patch-1

main.js: Improve dark mode
This commit is contained in:
Nate Smith 2024-08-26 13:30:58 -04:00 committed by GitHub
commit 6b43b2f2d9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -338,6 +338,12 @@ class ThemeToggler extends HTMLAnchorElement {
this.innerText = "◑"; this.innerText = "◑";
this.setAttribute("aria-hidden", "true"); this.setAttribute("aria-hidden", "true");
this.style.cursor = "pointer"; this.style.cursor = "pointer";
// Add color-scheme meta tag to style buttons
const colorSchemeMeta = document.createElement("meta");
colorSchemeMeta.name = "color-scheme";
colorSchemeMeta.content = this.theme;
document.head.appendChild(colorSchemeMeta);
} }
click() { click() {
@ -369,6 +375,7 @@ class ThemeToggler extends HTMLAnchorElement {
$(".corner .bordered").style.border = "1px solid black"; $(".corner .bordered").style.border = "1px solid black";
$$("a").forEach((e) => { e.style.color = "black" }); $$("a").forEach((e) => { e.style.color = "black" });
} }
$("meta[name=color-scheme]").content = this.theme;
} }
} }