Skip to content

infra(theme): add mobile theme toggle and default to system color scheme#156

Merged
marc0olo merged 1 commit into
mainfrom
infra/mobile-theme-toggle
Apr 28, 2026
Merged

infra(theme): add mobile theme toggle and default to system color scheme#156
marc0olo merged 1 commit into
mainfrom
infra/mobile-theme-toggle

Conversation

@marc0olo
Copy link
Copy Markdown
Member

Summary

  • Adds theme toggle to the mobile header by overriding Starlight's Header.astro. The toggle was only in the sl-hidden md:sl-flex right-group (desktop-only); a mobile-only copy is now rendered before it using md:sl-hidden.
  • Changes the default theme from hardcoded light to the visitor's prefers-color-scheme in both ThemeProvider.astro (FOUC-safe inline script) and ThemeSelect.astro (toggle logic). A stored user preference still takes priority on return visits.

Sync recommendation

hand-written

- Add custom Header.astro that renders ThemeSelect on mobile (outside
  the sl-hidden md:sl-flex right-group, which is desktop-only)
- Default theme to prefers-color-scheme instead of hardcoded light in
  both ThemeProvider.astro and ThemeSelect.astro; stored preference
  still takes precedence on return visits
@marc0olo marc0olo merged commit efe92b3 into main Apr 28, 2026
1 check passed
@marc0olo marc0olo deleted the infra/mobile-theme-toggle branch April 28, 2026 12:38
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.

1 participant