# Design tokens, visually

This page is the visual companion to the [Design system](https://docs.mapcairn.com/design.md) pages. It draws the tokens in both themes at once, whichever theme you chose for the site, and gives every value as text in a table beside the drawing.

It is generated when the site is built, from the values `@mapcairn/theme` exports. The contrast ratios use the same maths the SDK's tests use.

## Colour

### Light theme colours

Each sample below is the pair as the interface draws it. The table gives its measured contrast ratio and whether it meets the 4.5:1 limit for text and the 3:1 limit for icons, control edges and the focus ring. Surfaces are flattened over the theme's page background, as they are on this page.

#### Contrast of the pairs, light theme

| Pair | Used as | Ratio | 4.5:1 | 3:1 |
| --- | --- | --- | --- | --- |
| Text on surface | Text | 17.10:1 | Pass | Pass |
| Muted text on surface | Text | 7.66:1 | Pass | Pass |
| Accent on surface | Text | 7.14:1 | Pass | Pass |
| Error text on surface | Text | 7.05:1 | Pass | Pass |
| Text on selected tint | Text | 14.10:1 | Pass | Pass |
| Error text on error tint | Text | 6.12:1 | Pass | Pass |
| Text on accent | Text | 7.22:1 | Pass | Pass |
| Text on page | Text | 14.95:1 | Pass | Pass |
| Muted text on page | Text | 6.70:1 | Pass | Pass |
| Control edge on surface | Non-text | 5.21:1 | Pass | Pass |
| Focus ring on surface | Non-text | 4.86:1 | Pass | Pass |

#### Every colour role, light theme

| Role | Value |
| --- | --- |
| `surface` | `oklch(1 0 0 / 0.92)` |
| `surfaceRaised` | `oklch(1 0 0 / 0.94)` |
| `text` | `oklch(0.22 0.01 250)` |
| `textMuted` | `oklch(0.44 0.012 250)` |
| `accent` | `oklch(0.46 0.15 255)` |
| `accentTint` | `oklch(0.93 0.032 255)` |
| `accentContrast` | `oklch(1 0 0)` |
| `hairline` | `oklch(0.22 0.01 250 / 0.12)` |
| `controlBoundary` | `oklch(0.53 0.012 250)` |
| `chromeBorder` | `transparent` |
| `danger` | `oklch(0.48 0.17 27)` |
| `dangerTint` | `oklch(0.95 0.024 25)` |
| `scrim` | `oklch(0 0 0 / 0.4)` |
| `focusRing` | `oklch(0.55 0.175 255)` |
| `focusRingInner` | `oklch(1 0 0)` |
| `pageBackground` | `oklch(0.95 0.008 85)` |
| `mapBackground` | `#f8f4f0` |
| `mapGlobeSpace` | `oklch(0.82 0.02 250)` |
| `mapPin` | `oklch(0.55 0.175 255)` |
| `mapMeasureLine` | `oklch(0.55 0.175 255)` |
| `mapMeasureFill` | `oklch(0.55 0.175 255 / 0.18)` |
| `mapAccuracy` | `oklch(0.55 0.175 255)` |
| `mapAccuracyFill` | `oklch(0.55 0.175 255 / 0.12)` |
| `mapHalo` | `oklch(1 0 0)` |

### Dark theme colours

Each sample below is the pair as the interface draws it. The table gives its measured contrast ratio and whether it meets the 4.5:1 limit for text and the 3:1 limit for icons, control edges and the focus ring. Surfaces are flattened over the theme's page background, as they are on this page.

#### Contrast of the pairs, dark theme

| Pair | Used as | Ratio | 4.5:1 | 3:1 |
| --- | --- | --- | --- | --- |
| Text on surface | Text | 17.04:1 | Pass | Pass |
| Muted text on surface | Text | 11.97:1 | Pass | Pass |
| Accent on surface | Text | 9.82:1 | Pass | Pass |
| Error text on surface | Text | 10.11:1 | Pass | Pass |
| Text on selected tint | Text | 12.69:1 | Pass | Pass |
| Error text on error tint | Text | 7.74:1 | Pass | Pass |
| Text on accent | Text | 10.25:1 | Pass | Pass |
| Text on page | Text | 15.30:1 | Pass | Pass |
| Muted text on page | Text | 10.75:1 | Pass | Pass |
| Control edge on surface | Non-text | 6.86:1 | Pass | Pass |
| Focus ring on surface | Non-text | 7.94:1 | Pass | Pass |

#### Every colour role, dark theme

| Role | Value |
| --- | --- |
| `surface` | `oklch(0.19 0.008 250 / 0.92)` |
| `surfaceRaised` | `oklch(0.25 0.009 250 / 0.88)` |
| `text` | `oklch(0.975 0.003 250)` |
| `textMuted` | `oklch(0.86 0.007 250)` |
| `accent` | `oklch(0.8 0.095 255)` |
| `accentTint` | `oklch(0.3 0.06 255)` |
| `accentContrast` | `oklch(0.17 0.008 250)` |
| `hairline` | `oklch(1 0 0 / 0.14)` |
| `controlBoundary` | `oklch(0.7 0.01 250)` |
| `chromeBorder` | `transparent` |
| `danger` | `oklch(0.82 0.095 25)` |
| `dangerTint` | `oklch(0.3 0.07 25)` |
| `scrim` | `oklch(0 0 0 / 0.6)` |
| `focusRing` | `oklch(0.74 0.125 255)` |
| `focusRingInner` | `oklch(0.19 0.008 250)` |
| `pageBackground` | `oklch(0.24 0.008 250)` |
| `mapBackground` | `#45516e` |
| `mapGlobeSpace` | `oklch(0.31 0.025 255)` |
| `mapPin` | `oklch(0.74 0.125 255)` |
| `mapMeasureLine` | `oklch(0.74 0.125 255)` |
| `mapMeasureFill` | `oklch(0.55 0.175 255 / 0.28)` |
| `mapAccuracy` | `oklch(0.74 0.125 255)` |
| `mapAccuracyFill` | `oklch(0.55 0.175 255 / 0.2)` |
| `mapHalo` | `oklch(0.19 0.008 250)` |

## Type scale

Every step is set in IBM Plex Sans, the interface's one typeface. Sizes are in `rem`, so they follow the reader's own font size, and only the weights 400 and 600 exist.

| Step | Size | Line height | Tracking |
| --- | --- | --- | --- |
| `type.small` | 0.8125rem | 1.4 | 0.01em |
| `type.body` | 0.9375rem | 1.45 | 0em |
| `type.large` | 1.0625rem | 1.4 | -0.005em |
| `type.title` | 1.375rem | 1.25 | -0.015em |
| `type.display` | 2.5rem | 1.1 | -0.025em |

| Weight | Value |
| --- | --- |
| `type.weight.regular` | 400 |
| `type.weight.semibold` | 600 |

## Spacing and radius

Spacing bars are drawn at four times their size so the smallest step can be seen. Each radius is shown on the same square.

| Token | Value |
| --- | --- |
| `space.xxs` | 4px |
| `space.xs` | 8px |
| `space.sm` | 12px |
| `space.md` | 16px |
| `space.lg` | 24px |
| `space.xl` | 32px |

| Token | Value |
| --- | --- |
| `radius.pill` | 24px |
| `radius.sheet` | 20px |
| `radius.control` | 14px |
| `radius.inner` | 10px |
| `radius.round` | 50% |

## Component specimens

### Specimens, light theme

These are plain markup styled by the tokens alone, with no script, so they show the colours and shapes but do not respond.

| Specimen | Declarations |
| --- | --- |
| Secondary button | `background: color.surfaceRaised`, `color: color.text`, `border-color: color.controlBoundary`, `border-radius: radius.control`, `min-height: size.control`, `padding-inline: space.md`, `font-weight: type.weight.semibold` |
| Primary button | `background: color.accent`, `color: color.accentContrast`, `border-color: color.accent`, `border-radius: radius.control`, `min-height: size.control`, `padding-inline: space.md`, `font-weight: type.weight.semibold` |
| Text field | `background: color.surfaceRaised`, `color: color.textMuted`, `border-color: color.controlBoundary`, `border-radius: radius.control`, `min-height: size.control`, `padding-inline: space.md` |
| Chip | `background: color.accentTint`, `color: color.text`, `border-color: color.accent`, `border-radius: radius.pill`, `padding-inline: space.sm`, `padding-block: space.xxs` |
| Surface | `background: color.surface`, `color: color.text`, `box-shadow: shadow.floating`, `border-radius: radius.sheet`, `padding: space.md` |
| Raised surface | `background: color.surfaceRaised`, `color: color.text`, `box-shadow: shadow.floating`, `border-radius: radius.sheet`, `padding: space.md` |
| Focus ring | `outline: focusRing.outline`, `outline-offset: focusRing.outlineOffset`, `box-shadow: focusRing.boxShadow` |

### Specimens, dark theme

These are plain markup styled by the tokens alone, with no script, so they show the colours and shapes but do not respond.

| Specimen | Declarations |
| --- | --- |
| Secondary button | `background: color.surfaceRaised`, `color: color.text`, `border-color: color.controlBoundary`, `border-radius: radius.control`, `min-height: size.control`, `padding-inline: space.md`, `font-weight: type.weight.semibold` |
| Primary button | `background: color.accent`, `color: color.accentContrast`, `border-color: color.accent`, `border-radius: radius.control`, `min-height: size.control`, `padding-inline: space.md`, `font-weight: type.weight.semibold` |
| Text field | `background: color.surfaceRaised`, `color: color.textMuted`, `border-color: color.controlBoundary`, `border-radius: radius.control`, `min-height: size.control`, `padding-inline: space.md` |
| Chip | `background: color.accentTint`, `color: color.text`, `border-color: color.accent`, `border-radius: radius.pill`, `padding-inline: space.sm`, `padding-block: space.xxs` |
| Surface | `background: color.surface`, `color: color.text`, `box-shadow: shadow.floating`, `border-radius: radius.sheet`, `padding: space.md` |
| Raised surface | `background: color.surfaceRaised`, `color: color.text`, `box-shadow: shadow.floating`, `border-radius: radius.sheet`, `padding: space.md` |
| Focus ring | `outline: focusRing.outline`, `outline-offset: focusRing.outlineOffset`, `box-shadow: focusRing.boxShadow` |

## Code colours

### Code colours, light theme

Code is the one place hues beyond the accent appear. The ratio is measured on the code block's background, the raised surface over the page.

| Role | Value | Ratio | 4.5:1 |
| --- | --- | --- | --- |
| `keyword` | `oklch(0.45 0.12 305)` | 7.79:1 | Pass |
| `string` | `oklch(0.45 0.09 155)` | 7.05:1 | Pass |
| `number` | `oklch(0.47 0.1 40)` | 7.06:1 | Pass |
| `comment` | `oklch(0.49 0.012 250)` | 6.20:1 | Pass |
| `function` | `oklch(0.46 0.15 255)` | 7.16:1 | Pass |
| `className` | `oklch(0.45 0.08 200)` | 7.06:1 | Pass |
| `property` | `oklch(0.45 0.08 100)` | 7.33:1 | Pass |
| `punctuation` | `oklch(0.44 0.012 250)` | 7.68:1 | Pass |
| `operator` | `oklch(0.34 0.011 250)` | 11.64:1 | Pass |

### Code colours, dark theme

Code is the one place hues beyond the accent appear. The ratio is measured on the code block's background, the raised surface over the page.

| Role | Value | Ratio | 4.5:1 |
| --- | --- | --- | --- |
| `keyword` | `oklch(0.8 0.1 305)` | 8.31:1 | Pass |
| `string` | `oklch(0.82 0.1 155)` | 9.55:1 | Pass |
| `number` | `oklch(0.82 0.1 40)` | 8.89:1 | Pass |
| `comment` | `oklch(0.74 0.009 250)` | 6.96:1 | Pass |
| `function` | `oklch(0.8 0.095 255)` | 8.60:1 | Pass |
| `className` | `oklch(0.82 0.08 200)` | 9.46:1 | Pass |
| `property` | `oklch(0.84 0.09 100)` | 9.88:1 | Pass |
| `punctuation` | `oklch(0.86 0.007 250)` | 10.48:1 | Pass |
| `operator` | `oklch(0.915 0.005 250)` | 12.47:1 | Pass |
