Declare the primary colour scale where Tailwind v4 reads it - #3
Merged
Conversation
tailwind.config.js is a v3-style config and v4 never loads it: there is no @config directive in index.css. Every `primary-<number>` class the app wrote therefore generated no CSS at all — 568 across 60 files, including 38 buttons carrying text-white over a bg-primary-600 that painted nothing, and the focus-visible:ring-primary-500 CLAUDE.md prescribes for accessibility. Move the scale into the @theme block, which is the only place v4 reads. The values are Tailwind's own blue, unchanged. `--color-primary` is a separate token and is untouched: bg-primary has 213 call sites and must keep working. The failure was silent — no build error, no lint warning — so theme.test.ts compiles the real stylesheet and fails if a step stops resolving. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
The defect
frontend/tailwind.config.jsis a Tailwind v3-style config. The project runsTailwind v4 (
@import "tailwindcss"+@themeinsrc/index.css) and v4only reads a JS config when the stylesheet asks for it with
@config. There isno such directive, so that file never reaches the build.
Consequence: every
primary-<number>class in the app generated no CSS atall — 568 occurrences across 60 files. Among them:
text-whiteover abg-primary-600thatpaints nothing: white text on a white surface. The Forum alone holds 12 of
those files; also CommandPalette, HistoryView, AddToDossierPopover,
CompareView, StudyMode, Layout, and five modals.
focus:ring-primary-500,focus-visible:ring-primary-500)— including the one
CLAUDE.mdprescribes as the accessibility convention forkeyboard-reachable collapsibles. It has never been drawn.
text-primary-600, 32bg-primary-50, and a long tail of borders andhover states.
No build error, no lint warning, no runtime warning. An undeclared token is
indistinguishable from a typo.
The fix
Eleven tokens in the
@themeblock — the only place v4 reads. Values areTailwind's own blue, byte-identical to what the config already declared, so
nothing is redesigned; the classes the app already wrote simply start resolving.
--color-primaryis deliberately untouched. It is a different token, fed byhsl(var(--primary)), andbg-primaryhas 213 call sites. Loading the JSconfig with
@configwould have put both at risk: that file declaresprimaryas a scale with no
DEFAULT, and redeclares the semantic aliases without theirhsl()wrapper (background: 'var(--background)'against--background: 0 0% 100%). Adding the scale to@themeavoids the question entirely.The other 563 call sites are not edited. The token was missing; the classes were
always right.
Guarding it
src/theme.test.tscompiles the realindex.cssthrough PostCSS and assertsevery step of the scale resolves — and, in the same breath, that
bg-primary,ring-ringandbg-backgroundstill do. Written before the fix and watchedfail. This is the test that would have caught the bug when it was introduced.
tailwind.config.jskeeps a header saying it is not loaded. It is not deleted:its fate is a separate decision. What it still declares and still cannot apply —
font-sans/font-serif/font-mono(whose fonts are never fetched anyway),shadow-glow,shadow-glass-lg,animate-shimmer— is 4 call sites in total.Verification
npx vitest run src/theme.test.ts— red before the change, green afternpm run test189 passed ·npm run buildclean ·npm run lintcleanbg-primary-600,text-primary-600,ring-primary-500(×16),bg-primary-50(×24),border-primary-200--color-primary: hsl(var(--primary))Note for the reviewer
~59 files change appearance at once — in the direction of something missing
becoming visible, not the reverse. A pass over search, dossier, workspace and
especially the Forum is worth doing after merge.
🤖 Generated with Claude Code