Skip to content

[P2][convention] 340 hardcoded palette colours in 46 files bypass the theme tokens #706

Closed

Description

@EVWorth

Counted across src/components:

1450  var(--color-*) token usages
 340  hardcoded Tailwind palette classes (text-red-400, bg-amber-900, …)
  46  of 70 component files contain at least one

The token system is real and mostly followed — 81% of colour usage goes
through it. The remaining 19% is the problem, because a hardcoded colour is
the same value in both themes by definition.

Most common offenders:

78  text-red-400      39  bg-red-500      25  text-green-400
23  border-red-500    22  text-yellow-400  16  text-amber-400

These are overwhelmingly status colours — errors, warnings, success — for
which tokens already exist (--color-error, --color-warning,
--color-success). The token was available and the palette class was reached
for instead.

Why it matters beyond tidiness

#218 was filed because the Compare feature rendered light dropdowns with
invisible labels in dark mode. That was fixed at the instance. The cause —
colours chosen outside the token system, which therefore cannot respond to a
theme — is still present in 46 files, and #700 shows what happens when a
theme's values are not held to a standard.

It also blocks custom themes. NFR-5.2 wants user themes (#350); a theme can
only restyle what goes through tokens, so today a custom theme would leave 340
colours untouched.

Fix

  1. Map the status colours onto existing tokens — that is the bulk of the 340.
  2. For the genuine gaps (bg-red-500/15 tinted panels, amber "caution"
    surfaces), add the tokens they imply: --color-error-surface,
    --color-warning-surface, --color-success-surface, and their
    light-theme values.
  3. Add a lint rule banning bare palette classes in src/components, so the
    count cannot climb back.

Step 3 is what makes this stick. Without it this is a cleanup that decays.

Found during the UI review. Depends on #700 landing first, so the tokens
these map onto are themselves correct in light theme.

Activity

  1. added
    audit
    severity/p2
    kind/convention
    area/theming
    on Sep 17, 2026
  2. added a commit that references this issue on Sep 17, 2026
    de12fcb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/themingauditkind/conventionseverity/p2

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions