Skip to content

Rule · Lint

Hard-coded colors in components instead of tokens

lint/hardcoded-colorswarnvoid lintupdated

Why it matters

Raw hex/rgb values and default palette classes (bg-indigo-500) in components bypass the semantic tokens, so dark mode, theming and contrast fixes have to be done file by file and the palette drifts.

How to fix it

Use semantic token utilities (bg-surface, text-fg-muted, border-line, bg-brand). Keep raw colors inside token/theme files, OG image generators and SVG artwork.

Example

tsx
<div className="bg-surface text-fg border-line" />   // not style={{ background: '#0e0e11' }}

References

void lint reports 67 rules in this category. Static source checks with no browser: Tailwind v4 silent failures, Next.js 16 API traps, React render-body bugs, accessibility markup, SEO files and motion hygiene.