# Color Tokens

## Contrast-Based Naming

Theme colors use a **subtle → strong** scale that works across light and dark modes:

| Token | Light Mode | Dark Mode | Use Case |
| - | - | - | - |
| `subtlest` | Lightest tint | Darkest shade | Subtle backgrounds |
| `subtle` | Light tint | Dark shade | Muted backgrounds |
| `soft` | Medium-light | Medium-dark | Soft accents |
| `base` | Core color | Adjusted core | Primary brand use |
| `strong` | Medium-dark | Medium-light | Text on backgrounds |
| `stronger` | Dark | Light | High-contrast text |
| `strongest` | Darkest | Lightest | Maximum contrast |

The key insight: **"stronger" always means more contrast** against the contextual background, regardless of light/dark mode.

## Default Color Palettes

Tangible Design System ships with the following color defaults. When extending the system with new components these are the only allowed color tokens, and colors must *never* be hardcoded.

For deterministic identity colors (avatar initials, tags, category accents) see [Generative Colors](https://design.tangible.one/docs/tokens-generative-colors.md) — those are intentionally outside the theme ladders.

### Brand Colors

---

Visual swatches: [see the interactive page](https://design.tangible.one/?path=/docs/tokens-colors--docs). Token values are in [the primitive token reference](https://design.tangible.one/docs/reference-primitive-tokens.md).

### Semantic Colors

---

### Neutral Colors

---

Neutrals use **role names**, not the contrast ladder. The background roles, from the canvas up:

| Token | Role |
| - | - |
| `bg-surface` | The page canvas *behind* components — a light gray by design, so white component faces read as raised against it. Also the fill for bordered panels sitting on a white face. |
| `bg` | Component faces (cards, inputs, menus) — white in light mode. |
| `bg-muted` | Muted wells *within* a component face: readouts, submitted-text panels, disabled fills. |
| `bg-elevated` | Overlaid faces (popovers, modals) — white, lifted by shadow rather than color. |
| `bg-inverted` | Inverted panels (tooltips, dark callouts). |
| `bg-overlay` | The translucent backdrop behind modals. |

Foregrounds follow the same pattern: `fg` for body text, `fg-secondary` for supporting text, `fg-muted` for meta/hints, `fg-on-accent` for white text on accent fills, `fg-inverted` for text on inverted panels.

`neutral` is the theme for things with nothing to act on: a draft, an unset value, an idle step. It's the gray ladder from the `$neutral` palette. `secondary` is a brand colour; by default its steps alias neutral's, so the two look the same until a host gives secondary its own colour.

Text on a theme's `base` fill comes from that theme's own `--tui-theme-{name}-on-base`. It's white in light mode. In dark mode the fills get lighter, so `secondary`, `neutral`, `success`, `warning` and `danger` switch to dark text (5.0–7.4:1, where white measured 2.5–3.7:1); `primary` and `info` stay white. Use `on-base`, not `fg-on-accent`, whenever you put text on a theme fill.

A solid fill's hover step is `--tui-theme-{name}-interact`, with `--tui-theme-{name}-on-interact` for the text on it. Both are unset by default, so components fall back to the ladder (`-stronger` and `-on-base`; secondary's `-soft` and `-strongest`); dark mode sets primary and info to `-soft`, which keeps their white text at 7.5:1. Set one on `.tui-interface` to restyle that theme's hovers everywhere.

## Customization

Color customization is fairly straightforward, since all colors consumed by components are attached to global CSS custom properties.

The default palettes can be overridden by re-defining the CSS custom properties. In most cases, this change will be scoped to `tui-interface` in order to impact all components within the defined Tangible frontend scope.

```css
/* Re-map Primary colors to a calming sage green */
.tui-interface {
  --tui-theme-primary-strongest:  #242424;
  --tui-theme-primary-stronger:   #535249;
  --tui-theme-primary-strong:     #797762;
  --tui-theme-primary-base:       #a9ad7f;
  --tui-theme-primary-soft:       #b6c48b;
  --tui-theme-primary-subtle:     #c2dc9c;
  --tui-theme-primary-subtlest:   #d7f2c5;
}

```

---

Interactive version: https://design.tangible.one/?path=/docs/tokens-colors--docs
