theme-init.js 376 B

123456789
  1. try {
  2. var theme = localStorage.getItem("theme");
  3. var dark = theme === "dark";
  4. var root = document.documentElement;
  5. root.classList.toggle("dark", dark);
  6. // Pre-paint background to avoid a flash before the CSS bundle loads.
  7. // Applied via CSSOM so it is not blocked by the strict style-src CSP.
  8. root.style.background = dark ? "#101014" : "#f9fafb";
  9. } catch (e) {}