Theme switcher

System, Light and Dark, in the bottom right of the footer.

Usage

System is the default and follows the visitor’s OS setting, including when it changes. A choice is saved inlocalStorage under theme; picking System clears it.

Color theme
<ThemeSwitcher />

How it works

An inline script in Base.astro applies the theme before the page paints, so there’s no flash. It setsdata-theme="light|dark" on <html>, which switches the semantic tokens (seeColor), and exposes window.setTheme('system' | 'light' | 'dark'). Only semantic color.* tokens change between themes, so components that use them need no dark-mode CSS.