// This function prevents the 'flash of unstyled content'
// Include it at the top of <head>
(function() {
  let theme = localStorage.getItem("theme") || "system";
  if (theme === "system") {
    theme = window.matchMedia("(prefers-color-scheme: dark)").matches
      ? "dark"
      : "light";
  }
  if (theme === "dark") {
    document.documentElement.classList.add("dark");
  } else {
    document.documentElement.classList.remove("dark");
  }
})();
