Add dark color scheme
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
<script>
|
||||
function paigeResize() {
|
||||
var s = document.querySelector('section[class="paige-content"]');
|
||||
var mw = getComputedStyle(s).maxWidth;
|
||||
var e = document.querySelector('section[class="paige-content"]');
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
var mw = getComputedStyle(e).maxWidth;
|
||||
var w;
|
||||
if (mw === "none") {
|
||||
var e = document.querySelector("body > div.container");
|
||||
@@ -22,11 +25,24 @@ function paigeResize() {
|
||||
}
|
||||
paigeResize();
|
||||
addEventListener("resize", paigeResize);
|
||||
{{ if not .Site.Params.paige.color_scheme }}
|
||||
var paigeQuery = matchMedia("(prefers-color-scheme: dark)");
|
||||
if (paigeQuery.matches) {
|
||||
document.documentElement.setAttribute("data-bs-theme", "dark")
|
||||
}
|
||||
paigeQuery.addEventListener("change", function (e) {
|
||||
if (e.matches) {
|
||||
document.documentElement.setAttribute("data-bs-theme", "dark");
|
||||
} else {
|
||||
document.documentElement.removeAttribute("data-bs-theme");
|
||||
}
|
||||
});
|
||||
{{ end }}
|
||||
</script>
|
||||
<noscript>{{ i18n "paige_noscript" }}</noscript>
|
||||
{{ partial "paige/script" (dict
|
||||
"integrity" (.Site.Params.paige.bootstrap.script.script_integrity | default "sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3")
|
||||
"src" (.Site.Params.paige.bootstrap.script.script_src | default "https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js")
|
||||
"integrity" (.Site.Params.paige.bootstrap.script.script_integrity | default "sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN")
|
||||
"src" (.Site.Params.paige.bootstrap.script.script_src | default "https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js")
|
||||
) }}
|
||||
{{ if or .Params.paige.math (and .Params.paige.show_full_pages (where .Pages "Params.paige.math" "eq" true)) }}
|
||||
{{ partial "paige/script" (dict
|
||||
|
Reference in New Issue
Block a user