| 1 | // Applied before the body renders, so a stored "light" preference does not | |
| 2 | // flash the default dark theme on first paint. Kept separate from theme.js | |
| 3 | // (which is deferred) because this one has to block instead. | |
| 4 | (function () { | |
| 5 | try { | |
| 6 | if (localStorage.getItem("dogfood-theme") === "light") { | |
| 7 | document.documentElement.setAttribute("data-theme", "light"); | |
| 8 | } | |
| 9 | } catch (e) { | |
| 10 | // Storage blocked — falls back to the default theme, same as no JS. | |
| 11 | } | |
| 12 | })(); |
12 lines · JavaScript