This page ships a Markdown twin for AI tools.

ComponentsColor swatch

displaytexulinot agent-emittableapp

Color swatch

color-swatch

A chip of a closed palette, role or data-viz color with contrast ink from tokens. Never free CSS.

One token contract, every theme. Display components take color, radius, density and state styling from the --tx-* token contract — the same variables the theme strip below overrides — so a theme swap re-colors them without per-component fixes.

Live examples

Primary swatch

Primary swatch

Loading demo…

Chart series

Chart series

In your theme

This page renders in the site theme, enterprise-neutral. Every one of the 210 library themes re-colors every component through the --tx-* contract. The three below carry real token values from the library, rendered at build — no island, no extra requests.

  • Violet

    light mode · AA contrast

    • background
    • surface
    • primary
    • accent
    • border
    Open Theme Studio
  • Monochrome

    light mode · AA contrast

    • background
    • surface
    • primary
    • accent
    • border
    Open Theme Studio
  • Accessible Dark Contrast

    dark mode · AAA contrast

    • background
    • surface
    • primary
    • accent
    • border
    Open Theme Studio

Props

Public props for Color swatch
NameKindRequiredDefaultDescription
colorenum (chart-1, chart-2, chart-3, chart-4, chart-5, chart-6, chart-7, chart-8, primary, secondary, success, warning, destructive, info, neutral)no"primary"Closed color reference (chart-1…8 or a role token)
sizeenum (sm, md, lg)no"md"—
labelstringno—Plain-text label, escaped
classstringno——
childrenslotno—Rich label content; replaced by a non-empty label

Keyboard

Keyboard behavior for Color swatch
KeyAction
aPair the fill with a text label; never convey the color by fill alone.

Accessibility

  • Pair the fill with a text label; never convey the color by fill alone.

Evidence for color-swatch

Latest committed gates for color-swatch (as of 2026-10-23). Static snapshot — not live CI.

Behavior

n/ano behavior scenario

No dedicated behavior scenario for this catalog id (a styled or display surface, covered by its unit and axe tests).

Size (gzip)

texuli/color-swatch · budget 12.0 KiB

Budget from texuli.budgets.json; re-measure with `pnpm size --filter <entry>`.

Axe

documented

  • tests/e2e/site-component-pages.spec.ts
  • docs/quality (a11y-*)

Site component pages axe gate; package-level a11y docs under docs/quality when present.

Browsers

  • chromium
  • webkit
  • mobile

Playwright projects: Desktop Chrome, Desktop Safari, Pixel 7. Firefox is a known gap on this host.

When to use

Use when

  • Show a named token or series color in a legend, key or palette

Don’t use when

Prefer another component

  • A status label (use badge)
  • A long-form color name in a sentence (use text)