# Theming

> Mode, preset and density are attributes, not separate stylesheets. Components never change.

## Light and dark

The `dark` class switches every color role. Put it on `<html>` for the whole app, or on any element to scope it:

```tsx
import { ThemeScope } from "@/lib/theme";

<ThemeScope mode="light" preset="graphite">
  <RunReview />
</ThemeScope>
```

Overlays opened inside a `ThemeScope` (menus, dialogs, tooltips, toasts) mount inside it, so they keep the scope's theme.

## Presets

| Preset | Character | Modes |
| --- | --- | --- |
| `graphite` | Native and neutral, Mac-like materials, system blue | light, dark |
| `flight-deck` | Soft graphite with a blue bias, ice-blue action, no glass | dark |
| `deep-space` | Near-black, nebula light, frosted glass | dark |

Each tool in a suite can pick its preset and keep its own character while clearly belonging to the same family. Presets without a light mode fall back to Graphite light.

## Tokens

Colors use the shadcn role names (`background`, `foreground`, `card`, `primary`, `muted-foreground`, …) plus `subtle-foreground`, `selection`, status roles (`success`, `warning`, `info`, `destructive`, each with a readable `-foreground` text color) and chart roles. The source is `packages/tokens/src/index.ts`; `pnpm tokens` generates CSS, DTCG JSON and React Native values and fails if any declared pair misses WCAG AA.

## React Native and Expo

Native apps cannot read CSS variables. Import the generated hex values instead:

```ts
import { colors, radii } from "@dtheo/tokens/native";

const card = colors.graphite.dark.card;
```
