Skip to content

Status colors

Five status intentsneutral, info, success, warning, error — each with a bg / fg / border triple that switches with data-theme. Components like Alert, Badge, and Toast resolve their variants through these tokens; the .hc-status utility below applies the same palette to any element — a table cell, a whole row, a line of text — so server-computed status never needs raw hex values or hand-written dark-mode overrides.

TokenCSS variable
semantic.color.status.{intent}.bg--hc-color-status-{intent}-bg
semantic.color.status.{intent}.fg--hc-color-status-{intent}-fg
semantic.color.status.{intent}.border--hc-color-status-{intent}-border

with {intent} one of neutral | info | success | warning | error. Light values are tints (*-50 background, *-800 text); under [data-theme="dark"] they re-emit as dark tints (*-950 background, *-200 text), so fg works as standalone text and on its paired bg in both themes.

.hc-status colours the element’s text with the intent’s fg; the intent is the usual data-variant (omitted = neutral). Add data-fill for the paired tinted background.

deployingcompleteddegradedfailedactive

The common server-rendered case: a status column whose class is computed server-side, and a row highlight for records needing attention. Works inside Table (the row fill also wins over the table’s hover background):

JobStatus
nightly-synccompleted
outbox-dispatchfailed
reindexrunning

A Thymeleaf/JSP/ERB template binds the variant directly:

<td class="hc-status" th:attr="data-variant=${job.statusVariant}"
th:text="${job.status}"></td>

…replacing per-status classes with raw hex colors and duplicated [data-theme="dark"] overrides — the tokens carry the theme switch.

  • fg values meet WCAG AA (≥ 4.5:1) as standalone text on the default page/surface backgrounds and on their paired bg, in both themes.
  • Color alone is never the message: keep the status text (axe has nothing to say about a green dot, but your users do). For a pill-shaped label with a border, use Badge instead.
  • Themes — how data-theme switches the palette.
  • Alert / Badge / Toast — components built on the same tokens.