Skip to content

Proposal: Standardize status color tokens (info, success, warning, error) #683

Closed

Description

@rubyycheung

Summary

Standardize status/sentiment color tokens around a consistent, developer-friendly naming convention. Currently XDS uses a mix of abstract names (positive, negative) and concrete names (warning), with info aliased to accent. This proposal introduces 12 purpose-built status tokens that every feedback-oriented component can share.

Problem

The current token naming has several issues:

  1. Mixed abstraction levels — positive/negative are abstract, warning is concrete. The inconsistency adds cognitive load.
  2. Translation required — Component APIs use status="error" and type="error", but the underlying token is --color-negative. Developers (and LLMs) searching for "error" won't find the token directly.
  3. No dedicated info token — Informational status reuses --color-accent, coupling brand color to feedback semantics. These should be independently themeable.
  4. Missing text-on-subtle tokens — Components like FieldStatus reach into the raw palette (--color-red-text) because no status-level text token exists.

Proposal

12 status tokens (4 statuses × 3 intensities)

--color-status-info
--color-status-info-subtle
--color-status-info-text

--color-status-success
--color-status-success-subtle
--color-status-success-text

--color-status-warning
--color-status-warning-subtle
--color-status-warning-text

--color-status-error
--color-status-error-subtle
--color-status-error-text

Token intensity definitions

Suffix Purpose Example usage
(base) Solid fill, icon color, dot color Button bg, badge bg, avatar dot, progress fill
-subtle Tinted/deemphasized background Banner bg, toast bg, field status bg, data table cell bg, alert bg
-text Readable text on subtle background Banner title/desc, toast message, field status message, badge text

Component mapping

Component base -subtle -text
Banner icon bg title/description
Toast / Snackbar icon bg message
Badge / Tag fg or solid bg subtle bg text label
Alert / Callout icon, border bg message
FieldStatus — bg message
Button (destructive) bg (status-error) — —
Progress / ProgressBar fill track —
Avatar status dot dot fill — —
Stepper / Timeline step icon bg label
Data table cell — cell bg cell text
Form validation summary icon bg message list

Data visualization: use raw palette, not status tokens

Status tokens encode judgment — success means good, error means bad. But data visualization often shows direction without judgment. A metric going up 13% could be positive (revenue), negative (error rate), or neutral (traffic). Forcing that into status tokens breaks.

Recommendation: Use the existing raw palette tokens for data viz:

--color-red-text, --color-red-icon, --color-red-background
--color-green-text, --color-green-icon, --color-green-background
--color-blue-text, --color-blue-icon, --color-blue-background
... etc.

These are judgment-free — red is just red, not "error." The product/theme decides what color means "up" or "down" in their context. XDS already has a full set of palette tokens (red, green, blue, orange, purple, yellow, teal, cyan, pink, gray) with -background, -border, -icon, and -text variants each.

When to use which:

Context Use Example
Feedback UI (banners, toasts, inputs, badges) --color-status-* tokens Banner with status="error" → --color-status-error-subtle
Data viz with judgment (threshold exceeded, target met) --color-status-* tokens KPI card showing "Target exceeded" → --color-status-success
Data viz without judgment (trend direction, comparisons) --color-{palette}-* tokens "Revenue up 13%" → --color-green-text (theme decides green=up)
Decorative / categorical (tags, labels, chart series) --color-{palette}-* tokens "Beta" badge → --color-purple-background

This keeps two clean, non-overlapping systems: status tokens for meaning, palette tokens for color.

Design decisions

  • error over negative/danger — Matches what component APIs already call it (status="error", type="error"). Zero translation for developers or LLMs.
  • subtle over deemphasized — Industry standard (Radix, Chakra, Shadcn all use "subtle"). Shorter, easier to spell, universally understood.
  • info as its own token — Decouples informational feedback from brand accent, allowing independent theming.
  • No fifth status for "destructive" — Destructive and error use the same color in practice. If they ever need to diverge, add --color-destructive at that point.
  • status namespace — Groups all feedback tokens, greppable, won't collide with palette colors (--color-red-*) or semantic colors (--color-accent).
  • Raw palette for data viz — Status tokens encode judgment; palette tokens are judgment-free. Data visualization needs both depending on context. XDS already has comprehensive palette tokens (--color-{color}-{background|border|icon|text}), so no new tokens needed for this use case.

Migration path

Current token New token
--color-negative --color-status-error
--color-negative-deemphasized --color-status-error-subtle
--color-positive --color-status-success
--color-positive-deemphasized --color-status-success-subtle
--color-warning --color-status-warning
--color-warning-deemphasized --color-status-warning-subtle
--color-accent (when used for info) --color-status-info
--color-accent-deemphasized (when used for info) --color-status-info-subtle
--color-red-text (in status contexts) --color-status-error-text
--color-yellow-text (in status contexts) --color-status-warning-text
--color-green-text (in status contexts) --color-status-success-text

LLM discoverability

Adding a mapping comment at the top of the token file helps both developers and AI tools:

/*
 * Status tokens — use for communicating feedback:
 *   info    → informational banners, tooltips, stepper current step
 *   success → success banners, valid input, completed steps
 *   warning → warning banners, caution input states, threshold alerts
 *   error   → error banners, invalid input, destructive actions, failed steps
 *
 * base    → solid fills (buttons, badges, dots, icons)
 * subtle  → tinted backgrounds (banners, toasts, field status, table cells)
 * text    → readable text on subtle backgrounds
 *
 * For data visualization (trends, comparisons, chart series), use raw palette
 * tokens (--color-red-*, --color-green-*, etc.) instead of status tokens.
 * Status tokens encode judgment; palette tokens are judgment-free.
 */

Scope

This is an additive change — new tokens can be introduced alongside existing ones, with components migrated incrementally. Old tokens can be deprecated with @deprecated JSDoc tags pointing to the new names.

Activity

  1. added
    enhancement
    theming
    on Mar 19, 2026
  2. cixzhang commented on Mar 21, 2026

    @cixzhang
    Contributor

    I'd rather not keep old tokens around. Do we want to take this direction? If so would rather do it before soft launch. Updating public tokens involves many downstream effects in the ecosystem so once we're settled we should be very careful about updating them.

  3. rubyycheung commented on Mar 21, 2026

    @rubyycheung
    ContributorAuthor

    I didn't realize Navi put up a PR for this, closing now

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

    enhancementtheming

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions