Jump to…
snowinitial commitqoxwzsukwmkx1mo
Matt W1// Applied before the body renders, so a stored "light" preference does not
Matt W2// flash the default dark theme on first paint. Kept separate from theme.js
Matt W3// (which is deferred) because this one has to block instead.
Matt W4(function () {
Matt W5 try {
Matt W6 if (localStorage.getItem("dogfood-theme") === "light") {
Matt W7 document.documentElement.setAttribute("data-theme", "light");
Matt W8 }
Matt W9 } catch (e) {
Matt W10 // Storage blocked — falls back to the default theme, same as no JS.
Matt W11 }
Matt W12})();

12 lines · JavaScript