Skip to content

feat: Material theme system (#187) - #203

Merged
mallowigi merged 9 commits into
nextfrom
feat/187-themes
Nov 18, 2026
Merged

mallowigi merged 9 commits into
nextfrom
feat/187-themes

Conversation

@mallowigi

Copy link
Copy Markdown
Collaborator

Closes #187 (part of #185)

What this does

Ports the prototype's theme system to the real Starlight site: 32 Material themes, switchable from a floating button, persisted, applied before first paint. The light/dark toggle is gone; each theme is light or dark by its own definition.

How it works & what to look at

  • src/components/overrides/ThemeProvider.astro: overrides Starlight's provider. An inline <head> script resolves the theme (?theme= → localStorage → default oceanic) and sets html[data-material-theme] / data-theme before the body is parsed, so there is no flash. Exposes window.materialTheme.
  • src/pages/material-themes.css.ts: a build-time endpoint generating /material-themes.css with one :root[data-material-theme=...] block per theme, mapped onto Starlight's --sl-color-* variables. Data comes from src/data/themes.ts / themes.yml.
  • PageTitle.astro + src/styles/custom.css: ribbon title; the TOC is a CSS-only floating card (no PageSidebar override needed yet).
  • src/components/theme/ThemeFab.astro: floating button + native popover with theme cards. Plain <script> on purpose: one small component doesn't justify a framework runtime.
  • astro.config.mjs: component overrides, fonts, and Expressive Code themes (5 Material themes map to bundled Shiki themes; others fall back by light/dark).
  • Tooling: oxlint, oxfmt, and Prettier (only for .astro, which oxfmt skips), run in CI. Legacy Jekyll content is excluded from formatting.

Notes

Verification

pnpm lint, pnpm format:check, pnpm check, pnpm test:e2e all pass locally (no-flash, persistence, ?theme=, all 32 themes, no toggle).

@mallowigi
mallowigi merged commit 21a39f3 into next Nov 18, 2026
1 check passed
@mallowigi
mallowigi deleted the feat/187-themes branch November 18, 2026 17:25
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