Files
novaconium/novaconium/pages/_layout/theme-init.twig
T
code fbd4e92e9f Replace v1 with v2 codebase
Full rewrite: swap out the v1 framework (src/, controllers/, views/,
twig/, sass/, skeleton/) for the working v2 codebase from phpproject
(App/, novaconium/, public/).
2026-07-14 01:58:25 +00:00

13 lines
536 B
Twig

{# Applies a saved theme choice before the page paints, so switching to
light doesn't flash dark first. Must run early in <head>, before the
stylesheet link — see novaconium/pages/_layout/layout.twig. Pairs with
the toggle button + its click handler in novaconium/pages/_layout/nav.twig. #}
<script>
(function () {
var saved = localStorage.getItem('theme');
if (saved === 'light' || saved === 'dark') {
document.documentElement.setAttribute('data-theme', saved);
}
})();
</script>