diff options
| author | Ariel Costas Guerrero <ariel@costas.dev> | 2025-11-06 23:36:52 +0100 |
|---|---|---|
| committer | Ariel Costas Guerrero <ariel@costas.dev> | 2025-11-06 23:36:52 +0100 |
| commit | 37d8eedd641bb04c086797010292bcb25240d56d (patch) | |
| tree | 85486542fc59e4b08485eba5625c9f923ca71ac1 /src/frontend/app/root.tsx | |
| parent | 0ac8ba208e0ad4d61cb82d6216c9cb34d43421a0 (diff) | |
Refactor styles and add alert color variables; implement scroll management for timetable
Diffstat (limited to 'src/frontend/app/root.tsx')
| -rw-r--r-- | src/frontend/app/root.tsx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/frontend/app/root.tsx b/src/frontend/app/root.tsx index 4815d2f..9bc69e4 100644 --- a/src/frontend/app/root.tsx +++ b/src/frontend/app/root.tsx @@ -76,6 +76,18 @@ export function Layout({ children }: { children: React.ReactNode }) { <title>Busurbano</title> <Meta /> + {/* Set theme early to avoid flash of wrong theme (especially skeletons) */} + <script + dangerouslySetInnerHTML={{ + __html: `(() => { try { + var saved = localStorage.getItem('theme'); + var system = (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) ? 'dark' : 'light'; + var resolved = (saved === 'light' || saved === 'dark') ? saved : system; + document.documentElement.setAttribute('data-theme', resolved); + document.documentElement.style.colorScheme = resolved; + } catch (e) {} })();`, + }} + /> <Links /> </head> <body> |
