Authoritative reference for theme-aware Tailwind classes used by the React frontend.
All components MUST use theme-aware Tailwind classes (bg-theme-*, text-theme-*, border-theme-*). Hardcoded color classes (e.g. bg-white, text-gray-700, bg-red-500) are forbidden — a pre-commit hook rejects them. The classes resolve via CSS custom properties defined in frontend/src/index.css, with light/dark mode toggled by the dark class on <html>.
Theme class allowlist gotcha:
bg-theme-secondary/bg-theme-tertiary/bg-theme-*-bgDO NOT EXIST. Usebg-theme-surface,bg-theme-background-secondary, orbg-theme-{success,warning,danger,info}(no-bgsuffix). Using non-existent classes silently produces white-on-white rendering.
// NEVER use hardcoded colors
<div className="bg-white text-black"> // WRONG
<div className="bg-gray-100 border-gray-300"> // WRONG
<div className="bg-red-500 text-red-700"> // WRONG
// EXCEPTION: text-white on colored backgrounds is allowed
<button className="bg-theme-primary text-white">OK</button> // ALLOWED| Hardcoded | Theme Class | Usage |
|---|---|---|
bg-white |
bg-theme-bg |
Page / app background |
bg-gray-50 |
bg-theme-surface |
Card / panel surface |
bg-gray-100 |
bg-theme-surface-alt |
Alternate surface |
bg-gray-800 |
bg-theme-surface-dark |
Dark surface (e.g., header) |
| Hardcoded | Theme Class | Usage |
|---|---|---|
text-gray-900 |
text-theme-primary |
Primary text |
text-gray-700 |
text-theme-secondary |
Secondary text |
text-gray-500 |
text-theme-tertiary |
Tertiary / muted text |
text-gray-400 |
text-theme-muted |
Placeholder text |
| Hardcoded | Theme Class | Usage |
|---|---|---|
border-gray-200 |
border-theme |
Standard border |
border-gray-300 |
border-theme-dark |
Emphasised border |
| Hardcoded | Theme Class | Usage |
|---|---|---|
bg-green-* |
bg-theme-success |
Success state |
bg-red-* |
bg-theme-error |
Error state |
bg-yellow-* |
bg-theme-warning |
Warning state |
bg-blue-* |
bg-theme-info |
Info state |
text-green-* |
text-theme-success |
Success text |
text-red-* |
text-theme-error |
Error text |
text-yellow-* |
text-theme-warning |
Warning text |
text-blue-* |
text-theme-info |
Info text |
| Hardcoded | Theme Class | Usage |
|---|---|---|
bg-blue-600 |
bg-theme-primary |
Primary button |
hover:bg-blue-700 |
hover:bg-theme-primary-hover |
Primary hover |
bg-gray-200 |
bg-theme-secondary |
Secondary button |
hover:bg-gray-300 |
hover:bg-theme-secondary-hover |
Secondary hover |
<div className="bg-theme-surface border border-theme rounded-lg shadow-sm">
<h3 className="text-theme-primary font-semibold">Title</h3>
<p className="text-theme-secondary">Description</p>
</div>// Primary
<button className="bg-theme-primary text-white hover:bg-theme-primary-hover">
Submit
</button>
// Secondary
<button className="bg-theme-secondary text-theme-primary hover:bg-theme-secondary-hover">
Cancel
</button>
// Danger
<button className="bg-theme-error text-white hover:opacity-90">
Delete
</button><input
className="
bg-theme-bg
border border-theme
text-theme-primary
placeholder:text-theme-muted
focus:border-theme-primary
focus:ring-theme-primary
"
placeholder="Enter value..."
/><span className="bg-theme-success/10 text-theme-success px-2 py-1 rounded">Active</span>
<span className="bg-theme-error/10 text-theme-error px-2 py-1 rounded">Failed</span>
<span className="bg-theme-warning/10 text-theme-warning px-2 py-1 rounded">Pending</span><table className="w-full">
<thead className="bg-theme-surface-alt">
<tr>
<th className="text-theme-secondary text-left p-3">Name</th>
<th className="text-theme-secondary text-left p-3">Status</th>
</tr>
</thead>
<tbody>
<tr className="border-b border-theme hover:bg-theme-surface">
<td className="text-theme-primary p-3">Item 1</td>
<td className="text-theme-secondary p-3">Active</td>
</tr>
</tbody>
</table>./scripts/fix-hardcoded-colors.shThe only allowed hardcoded color is text-white on coloured backgrounds:
<button className="bg-theme-primary text-white">Submit</button>
<div className="bg-theme-error text-white">Error message</div>
<span className="bg-theme-success text-white">Success</span>The project uses Tailwind CSS v4.1 with CSS-first configuration.
- Theme classes are defined via CSS custom properties in
frontend/src/index.css. - Dark mode uses the
darkclass on the<html>element. - Theme-aware classes (
bg-theme-*,text-theme-*) are custom utilities built on CSS variables. - Configuration:
frontend/tailwind.config.js.
- ../guides/frontend.md — Component patterns, design conventions
- ../guides/accessibility.md — Contrast, focus rings
- Tailwind config:
frontend/tailwind.config.js
docs/platform/THEME_SYSTEM_REFERENCE.md
Last verified: 2026-05-17