From 7fe9a178ba5f1c5a64ea394e2999bff777c0d89b Mon Sep 17 00:00:00 2001 From: Gil Gardosh Date: Mon, 24 Aug 2026 13:30:12 +0300 Subject: [PATCH] fix(client): activate the shadcn colour tokens MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `components.json` declared `cssVariables: false` and pointed at `tailwind.config.cjs`, a file that does not exist anywhere in the monorepo — it was deleted during the Tailwind v3 → v4 migration and the theme layer was never ported to v4's CSS-first `@theme`. So `--color-card`, `--color-muted-foreground`, `--color-destructive` and the rest were never registered, and Tailwind never generated the utilities that reference them. Roughly 380 usages across ~100 files were inert. Verified against two independent build outputs: `text-muted-foreground`, `bg-card`, `border-border` and `text-destructive` each emitted zero rules, while `bg-gray-900` emitted 25. Secondary text rendered at full-strength body colour, `bg-muted` / `bg-accent` / `bg-card` were transparent, and error text rendered black rather than red. Define the full token set in `@theme` on shadcn's `gray` base, with `.dark` overrides in `@layer base`. Plain `@theme` rather than `@theme inline`, since inline substitutes literals into each utility and would make the dark overrides dead code. Values are literal `oklch()` rather than `var(--color-gray-500)` references, because v4 only emits the default palette variables it sees used — referencing an otherwise-unused one would resolve to nothing. Tokens standing in for an existing default take that default's value, so previously-inert classes stay visually unchanged: background/card are white (already the page background), foreground is gray-950 (already the inherited text colour), border is gray-200 to match the `border-color` compatibility rule already in the base layer. The visible changes are the genuinely broken cases — muted text now reads gray-500, `text-destructive` reads red-600, and muted/accent/secondary backgrounds gain their light tint. Also fix `business/client/charts-section.tsx`, which set axis ticks with `hsl(var(--muted-foreground))`. That is v3 syntax: the v4 token holds a colour, not an HSL triplet, so the wrapper produced an invalid value and the ticks fell back to Recharts' default. Its `hsl(var(--chart-N))` siblings are correct and unchanged — that family really is stored as triplets. Dark mode stays inert: `next-themes` is installed but no `ThemeProvider` is mounted, so nothing puts `.dark` on an ancestor. The overrides are defined so the ~425 `dark:` utilities already in the codebase are correct when that switch is wired. Co-Authored-By: Claude Opus 5 (1M context) --- .changeset/activate-shadcn-color-tokens.md | 36 ++++++++ packages/client/components.json | 4 +- .../business/client/charts-section.tsx | 4 +- packages/client/src/index.css | 90 +++++++++++++++++++ 4 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 .changeset/activate-shadcn-color-tokens.md diff --git a/.changeset/activate-shadcn-color-tokens.md b/.changeset/activate-shadcn-color-tokens.md new file mode 100644 index 0000000000..822bf3d66a --- /dev/null +++ b/.changeset/activate-shadcn-color-tokens.md @@ -0,0 +1,36 @@ +--- +'@accounter/client': patch +--- + +Activate the shadcn colour tokens, which have been compiling to nothing since the Tailwind v4 +migration. + +`components.json` declared `cssVariables: false` and pointed `tailwind.config.cjs` — a file that does +not exist anywhere in the monorepo. It was deleted during the v3 → v4 migration and the theme layer +was never ported to v4's CSS-first `@theme`, so `--color-card`, `--color-muted-foreground`, +`--color-destructive` and the rest were never registered and Tailwind never generated the utilities +that reference them. Roughly 380 usages across ~100 files were inert: `text-muted-foreground`, +`bg-card`, `border-border` and `text-destructive` each emitted **zero** rules into the bundle, so +secondary text rendered as full-strength body colour, `bg-muted`/`bg-accent`/`bg-card` were +transparent, and error text rendered black instead of red. + +`src/index.css` now defines the full token set in `@theme` on shadcn's `gray` base, with `.dark` +overrides in `@layer base`. Values are literal `oklch()` rather than `var(--color-gray-500)` +references, because Tailwind v4 only emits the default palette variables it sees used — referencing +one that happens to be unused elsewhere would resolve to nothing. Tokens that stood in for an +existing default were given that default's value, so classes which were previously no-ops stay +visually unchanged: `--color-background`/`--color-card` are white (already the page background), +`--color-foreground` is gray-950 (already the inherited text colour), and `--color-border` is gray-200 +to match the `border-color` compatibility rule already in the base layer. The visible changes are the +genuinely broken cases — muted text now reads gray-500, `text-destructive` reads red-600, and +`bg-muted`/`bg-accent`/`bg-secondary` gain their light tint. + +Also fixes `business/client/charts-section.tsx`, which set its axis ticks with +`hsl(var(--muted-foreground))`. That is v3 syntax: the v4 token is `--color-muted-foreground` and +holds a colour rather than an HSL triplet, so the `hsl()` wrapper produced an invalid value and the +ticks fell back to Recharts' default. Its `hsl(var(--chart-N))` siblings are correct and unchanged — +the `--chart-*` family really is stored as triplets. + +Dark mode remains inert: `next-themes` is installed but no `ThemeProvider` is mounted, so nothing ever +puts `.dark` on an ancestor. The overrides are defined so the ~425 `dark:` utilities already in the +codebase are correct when that switch is eventually wired. diff --git a/packages/client/components.json b/packages/client/components.json index d940d3dc99..55d11a924e 100644 --- a/packages/client/components.json +++ b/packages/client/components.json @@ -4,10 +4,10 @@ "rsc": false, "tsx": true, "tailwind": { - "config": "tailwind.config.cjs", + "config": "", "css": "src/index.css", "baseColor": "gray", - "cssVariables": false, + "cssVariables": true, "prefix": "" }, "aliases": { diff --git a/packages/client/src/components/business/client/charts-section.tsx b/packages/client/src/components/business/client/charts-section.tsx index 26c4da34f2..475d631b47 100644 --- a/packages/client/src/components/business/client/charts-section.tsx +++ b/packages/client/src/components/business/client/charts-section.tsx @@ -88,9 +88,9 @@ export function ChartsSection() { - + } />