diff --git a/static/assets/color_mode_switcher.52334129.js b/static/assets/color_mode_switcher.52334129.js new file mode 100644 index 0000000..d963ca8 --- /dev/null +++ b/static/assets/color_mode_switcher.52334129.js @@ -0,0 +1 @@ +function a(){const t=localStorage.getItem("theme");return t||(window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light")}function c(t){const r=document.querySelector(".theme-switch i.fas");r.classList.toggle("fa-moon",t==="dark"),r.classList.toggle("fa-sun",t!=="dark")}let e=a();document.documentElement.setAttribute("data-bs-theme",e);window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{e=a(),document.documentElement.setAttribute("data-bs-theme",e),c(e)});window.addEventListener("load",()=>{c(e),document.querySelectorAll(".theme-switch").forEach(t=>{t.addEventListener("click",r=>{e=e==="light"?"dark":"light",document.documentElement.setAttribute("data-bs-theme",e),localStorage.setItem("theme",e),c(e),r.preventDefault()})})}); diff --git a/static/manifest.json b/static/manifest.json index 5f8b102..8f15350 100644 --- a/static/manifest.json +++ b/static/manifest.json @@ -116,6 +116,11 @@ "assets/js/index.js" ] }, + "assets/js/color_mode_switcher.js": { + "file": "assets/color_mode_switcher.52334129.js", + "src": "assets/js/color_mode_switcher.js", + "isEntry": true + }, "_echarts.128204f2.js": { "file": "assets/echarts.128204f2.js" }, diff --git a/templates/base.html b/templates/base.html index d7de133..fadd017 100644 --- a/templates/base.html +++ b/templates/base.html @@ -6,43 +6,6 @@ - - {{ meta | safe }} {% block stylesheets %} @@ -51,6 +14,8 @@ {{ Plugins.styles }} + {{ Assets.js("assets/js/color_mode_switcher.js", defer=False) }} +