fbd4e92e9f
Full rewrite: swap out the v1 framework (src/, controllers/, views/, twig/, sass/, skeleton/) for the working v2 codebase from phpproject (App/, novaconium/, public/).
13 lines
536 B
Twig
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>
|