Merge pull request #2 from noelleleigh/patch-1
main.js: Improve dark mode
This commit is contained in:
commit
6b43b2f2d9
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user