diff --git a/freezing/web/templates/base.html b/freezing/web/templates/base.html index c9dc612d..fa3ede2b 100644 --- a/freezing/web/templates/base.html +++ b/freezing/web/templates/base.html @@ -1,5 +1,5 @@ - + {% block title %} @@ -557,6 +557,10 @@ "dark" : "light"; document.querySelector("html").setAttribute("data-bs-theme", colorMode); + // Persist the theme to avoid light-mode always flashing in first + const date = new Date(); + date.setDate(date.getDate() + 30); + document.cookie = "theme=" + colorMode + "; expires=" + date.toUTCString() + "; path=/"; } // Set theme on load