preview-head.prod.html 545 B

1234567891011121314
  1. <base href="/storybook/" />
  2. <script>
  3. function handleThemeColor() {
  4. let themeColor = window.localStorage.getItem("theme-toggle:prefers-color-scheme");
  5. themeColor = themeColor ? JSON.parse(themeColor) : "auto";
  6. if (themeColor === "auto") {
  7. themeColor = window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light"
  8. } else if (!themeColor) {
  9. themeColor = "light";
  10. }
  11. document.documentElement.setAttribute("data-color-scheme", themeColor);
  12. }
  13. handleThemeColor();
  14. </script>