Skip to content

Kit: light/dark switch in the shared header - #59

Merged
emptymalei merged 1 commit into
hugofrom
claude/project-thread-yusfly
Oct 4, 2026
Merged

emptymalei merged 1 commit into
hugofrom
claude/project-thread-yusfly

Conversation

@emptymalei

Copy link
Copy Markdown
Member

Requested by L · project thread

Before: every InterImm site already turned dark when the visitor's system was set to dark, but there was no way to choose.

After: the shared header has a moon/sun switch next to GitHub and the language link. The choice is remembered in a cookie on interimm.org, so it carries across interimm.org, its project pages (/interplanetary-logistics/, /mars-map/, /mars-open-facilities/) and its subdomains (cities.interimm.org, book.interimm.org). Picking the theme the system already uses clears the choice, so the page follows the system again.

How: the kit's dark tokens now apply under prefers-color-scheme: dark unless data-theme="light" is on <html>, and always under data-theme="dark". interimm.js adds the switch to .nav-tools (or wires any [data-theme-toggle] button), sets data-theme-now, updates the browser bar colour, and exposes InterImm.theme plus an interimm:theme event for scripts that draw in colour. head.html applies a saved choice before first paint. The city plan image map is inverted in dark so it reads as white ink. kit/README.md documents the pattern for site styles. Additive: no class or token was renamed.

Companion PRs make the sister sites' own dark colours follow the switch: interplanetary-logistics, martian-cities, mars-map, mars-open-facilities (all branch claude/project-thread-yusfly).

Previews (local Hugo 0.135.0 build): project files dark-mode/ (home, phone menu, city plan, and each sister site).

🤖 Generated with Claude Code

https://claude.ai/code/session_01GXRSGzjJ5y9c6kGHNoH6uD


Generated by Claude Code

…mm sites

The kit already followed the system setting. Add a moon/sun switch to the header
tools that sets data-theme on <html> and keeps the choice in a cookie on
interimm.org (shared with its project pages and subdomains). Dark tokens now
apply under the system setting unless light is picked, or when dark is picked.
InterImm.theme and the interimm:theme event let page scripts follow it.
City plans are inverted in dark so they read as white ink on the dark page.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GXRSGzjJ5y9c6kGHNoH6uD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants