Repository navigation
feat: Material theme system (#187) - #203
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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→ defaultoceanic) and setshtml[data-material-theme]/data-themebefore the body is parsed, so there is no flash. Exposeswindow.materialTheme.src/pages/material-themes.css.ts: a build-time endpoint generating/material-themes.csswith one:root[data-material-theme=...]block per theme, mapped onto Starlight's--sl-color-*variables. Data comes fromsrc/data/themes.ts/themes.yml.PageTitle.astro+src/styles/custom.css: ribbon title; the TOC is a CSS-only floating card (noPageSidebaroverride needed yet).src/components/theme/ThemeFab.astro: floating button + nativepopoverwith 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).oxlint,oxfmt, and Prettier (only for.astro, which oxfmt skips), run in CI. Legacy Jekyll content is excluded from formatting.Notes
_data/themes.ymlmoves tosrc/data; the rest of_datamoves in [3] Content components and data files, proven on the accents and color-palette pages #188 to avoid conflicts.Footer.astrohosts the FAB; [6] Header navigation and footer #195 will extend it.Verification
pnpm lint,pnpm format:check,pnpm check,pnpm test:e2eall pass locally (no-flash, persistence,?theme=, all 32 themes, no toggle).