Add lib/theme.ts source-of-truth and theme-parity verify check#64
Merged
lwwmanning merged 1 commit intomainfrom May 4, 2026
Merged
Add lib/theme.ts source-of-truth and theme-parity verify check#64lwwmanning merged 1 commit intomainfrom
lwwmanning merged 1 commit intomainfrom
Conversation
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Signed-off-by: Will Manning <will@willmanning.io>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🔦 Lighthouse audit
Run |
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.
Summary
Establishes a single source of truth for design tokens shared between the runtime site (CSS) and
next/og-generated OG images (TS), and adds a CI-enforced parity check so the two sides can't drift silently.New file
src/lib/theme.ts:The OG card in
src/lib/og.tsxnow imports these constants instead of hardcoding hex literals. The doc comment notes thatforegrounddoesn't currently have a CSS-side counterpart (the site uses Tailwind's built-intext-white), but tracking it here gives the OG components a single name to import and an obvious destination if a future PR adds a--color-foregroundtoken.Bug fix bundled in: the OG card was painting its background
#0a0a0awhile the site's actual background is#101010(declared inglobals.css :rootas--background). They've quietly diverged since the OG component was scaffolded — close enough that nobody noticed, but inconsistent enough that a click-through from a social share lands on a slightly-lighter dark than the OG preview suggested. This PR converges them on#101010(the site's actual value), so OG previews now match the site exactly.New verify check
scripts/verify.ts → checkThemeParity():src/app/globals.cssfrom disk--backgrounddeclaration in:rootmatchesTHEME.backgroundTHEME.foreground(no CSS counterpart to compare against today)Catches the regression where someone updates one side without the other. Mirrors willmanning's parity-check pattern, narrowed to vortex's smaller token set.
Files
src/lib/theme.ts— the constants, with a header comment that explains the contract and points at the verify check.src/lib/og.tsx— importsTHEME, replacesbackgroundColor: "#0a0a0a"(now matches site) andcolor: "#ffffff"(unchanged value, just sourced fromTHEME). The translucent-white muted variants (rgba(255,255,255,0.7)/0.3) stay inline — they're alpha-derived fromforegroundrather than discrete tokens.scripts/verify.ts— addsnode:fs/promises+node:pathimports, a relative import ofTHEME, the newcheckThemeParity()function, and the correspondingawaitinmain().Local verification
Test plan
Lint, build, verifyruns the suite end-to-end including the new check)#101010backgrounds (paste preview URL into opengraph.xyz for a visual diff vs. main):root --background:inglobals.csswithout updatingtheme.ts, the verify check fails locally with a clear message🤖 Generated with Claude Code