Repository navigation
Move theming to semantic tokens with class-based dark mode - #16
Conversation
✅ Deploy Preview for 4rays ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7b67457b19
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Accepted
Verification: |
Backlog item
Move theming to semantic tokens with class-based dark mode (Tasker #517) (Goal 00f314685a5c), criterion C1 of the indigo-static migration.
Gap
Colors were global variables inside the
<style is:global>block ofsrc/layouts/Base.astro, switched by aprefers-color-schememedia query, so Tailwind'sdark:variant could not follow a site-controlled theme.src/layouts/Legal.astroredefined--background-colorwith its own media block, andLatticeBackgroundre-read its canvas colors on a schemematchMediachange only.Solution
src/styles.cssnow defines semantic tokens with the exact previous values: light on:rootand dark on.dark, withcolor-schemeset per scheme, plus the site-specific--lattice-*canvas inputs (new--lattice-accenttriplet keeps the canvas parser fed now that--accentis a full color). Tokens are exposed through@theme inlineas--color-*, and@variant dark (&:where(.dark, .dark *))enables the class-based variant. The html/body/::selection/:focus-visible/scrollbar rules moved into@layer baseusing the tokens.src/components/SetTheme.astro: anis:inlinescript rendered first inBase.astro's<head>that applies.darkon<html>from a validlocalStorage.theme(light, dark, system) or else the system scheme, before first paint, and follows live system-scheme changes while no theme is stored.Base.astroalso gains<meta name="color-scheme" content="light dark">. Its style block keeps only the fonts and the reading-column rule.index.astro,CircleLink.astro,CompanyLogo.astroandFooter.astrouse the new token names;rgb(var(--accent) / X)becamecolor-mix(in oklab, var(--accent) X%, transparent).LatticeBackground.astroreads--lattice-accentand re-reads colors when the.darkclass on<html>changes (MutationObserver on the class attribute) instead of on the scheme media query.prefers-color-schemecolor block inBase.astro, andLegal.astro's local override (no page uses it).Copy, fonts, layout, animations, and shadows are unchanged. A theme picker stays owner-deferred and out of scope.
Validation
pnpm check,pnpm format:check,pnpm buildall pass.rg -- '--(background-color|card-color|text-primary-color|text-secondary-color|logo-color|on-accent-color|hairline)' srcis empty;rg prefers-color-scheme srcmatches onlySetTheme.astro./renders identically in light and dark system schemes (page colors and lattice included),documentElementgains/loses.darkbefore first paint, emulating a scheme change with no reload flips page and lattice live, and the console shows no errors.No pre-existing failures to report.
Built by:
piharness, modelzai/glm-5.3-flash