Add light/dark theme toggle; show the order card only after a result
What
-
Theme toggle in the header (moon/sun icon). Defaults to the OS preference; the first click stores an explicit choice in
localStorage(kolo-theme). Adata-themeattribute, applied by a tiny head script before first paint, overridesprefers-color-schemein both directions, so there is no flash of the wrong theme.color-schemeis set per theme so native controls follow. Blocked storage degrades to a non-persistent toggle. -
Order Colocation card is now rendered
hiddenand shown only while the calculated price (#output) is visible. It hides again on empty input or errors. NoKOLO_ORDER_URLstill means no card at all. - No external resources. Audited the page: system font stack, inline CSS/JS and inline SVG only, nothing to vendor. Added a test so a CDN script, webfont or stylesheet can't sneak in later.
Testing
- TDD: new tests in
internal/api/api_test.go(toggle markup, CSS selectors, head script before<style>, hidden order card, no external refs), seen failing first.go test ./...passes. - Real browser check (headless Chromium, 23 assertions): OS light/dark, toggle both ways, persistence across reload, no flash, blocked
localStorage, order card visible only with a result (hidden on clear and on validation error), zero external requests, no console errors. Visually checked both themes at phone width.
Not changed
No API, config or Go runtime changes.