Skip to content
HHydro UIdocs
Navigate
FoundationHydro UI

Color

Semantic roles for readable, meaningful states.

Intent

Color roles are semantic, not component-specific. Components must use Layer 2 --hui-color-* aliases so an upstream design system can replace the palette without changing component CSS.

Roles

RoleTokenUse
Text--hui-color-textPrimary readable content and labels.
Muted text--hui-color-text-mutedSupporting copy and less prominent metadata.
Background--hui-color-backgroundPage/control background.
Raised background--hui-color-background-raisedCards, grouped surfaces, and elevated regions.
Link--hui-color-linkNon-button links in their default state.
Link hover/active--hui-color-link-hover, --hui-color-link-activePointer and pressed link states.
Border--hui-color-borderNeutral borders and separators.
Backdrop--hui-color-backdropModal scrim; defaults to the foreground color at 50% alpha.
Focus ring--hui-color-focus-ringKeyboard focus indicator. Never remove focus without an equivalent.
Interactive--hui-color-interactivePrimary controls and selected indicators.
Interactive hover/active--hui-color-interactive-hover, --hui-color-interactive-activePointer and pressed control states.
Interactive disabled--hui-color-interactive-disabledDisabled control foreground or indicator.
Interactive contrast--hui-color-interactive-contrastContent placed on the interactive color.
Danger--hui-color-dangerInvalid, destructive, or indeterminate messaging.
Disabled background--hui-color-disabled-backgroundDisabled control surfaces.

Accessibility rules

  • Maintain readable contrast for text and meaningful UI graphics.
  • Do not communicate state by color alone; preserve the component's state, text, or native semantics.
  • Focus must remain visible for keyboard users.
  • Use --hui-color-danger only for error or warning meaning, not as a decorative accent.

Upstream mapping

The Layer 1 palette is in tokens/base.tokens.json under ds.color.* and is emitted as --ds-color-*. Layer 2 aliases include a fallback literal, for example --hui-color-text: var(--ds-color-foreground, #0b0f14).

Optional Themes And Derived Colors

The default palette is unchanged. Set data-hui-theme="light", "dark", or "system" on the document element to opt into theme-aware semantic aliases and native color-scheme. System mode uses light-dark() with a dark-preference fallback. Dark primitives live under ds.color-dark.*; consumers may override them at the same upstream integration boundary. --hui-color-interactive-soft mixes the interactive and surface roles in Oklab. --hui-color-interactive-translucent uses relative RGB alpha where supported, with a color-mix() fallback. Both aliases have matching Tailwind color utilities. data-hui-contrast="auto" optionally enables contrast-color() for the interactive foreground. Explicit contrast pairs remain the default, and palette overrides still require contrast testing; automatic black/white selection is not a general accessibility guarantee.