Theming and tokens
Customize ComposerKit colors, nested light and dark scopes, chart palettes, and grid surfaces through one DESIGN.md pipeline.
ComposerKit derives every color, surface, border, chart series, and grid accent from one source file: packages/composerkit/DESIGN.md.
The single-source token pipeline
packages/composerkit/DESIGN.md
|
v pnpm --filter composerkit export:design (runs lint:design contrast checks)
packages/composerkit/src/styles/design-tokens.css (--color-light-* and --color-dark-*)
|
v imported by packages/composerkit/src/styles/globals.css
Semantic variables via CSS light-dark() + @theme inline utilitiesDo not hand-edit design-tokens.css. Edit DESIGN.md (or export a fresh one from the Theme editor) and regenerate with:
pnpm --filter composerkit export:designNested .light and .dark scoping
ComposerKit binds :root, .light, and .dark to CSS color-scheme and resolves semantic tokens with light-dark(...). Because light-dark() resolves against the nearest ancestor color-scheme, a .dark panel nested inside a .light page (or a .light preview nested inside a .dark shell) renders accurately at arbitrary nesting depth.
The custom Tailwind dark variant in globals.css follows the same rule:
@custom-variant dark (&:where(.dark, .dark *):not(:where(.dark .light, .dark .light *)));For inline literals that need to follow nested scopes, prefer semantic tokens or light-dark(lightValue, darkValue).
Chart and data-grid tokens
Chart palettes and data-grid surfaces live in the same DESIGN.md file:
| Token group | CSS variables | Purpose |
|---|---|---|
| Series palette | --chart-1 through --chart-6 | Distinct categorical colors for @composerkit/charts and grid range charts. |
| Financial delta | --chart-up, --chart-down | Positive and negative candlestick and waterfall encoding. |
| Heatmap scale | --chart-heat-low, --chart-heat-high | Continuous endpoints for heatmap series. |
| Grid surfaces | --grid-pinned, --grid-selected, --grid-range | Sticky rows/columns, selected rows, and active cell range highlights in TableCore. |
| Grid override hook | --tablecore-pinned-background | Per-instance override for --color-grid-pinned without editing global tokens. |
Brand seed generation and fixed tokens
When you generate a custom theme in the Theme editor, apps/docs/lib/theme/model.ts re-hues neutral and accent tokens while keeping fixedTokens untouched. All chart-* prefixes are guarded in fixedTokens so picking a monochrome or muted brand seed never collapses distinct chart series into indistinguishable grays.
Every generated theme must pass WCAG 4.5:1 and APCA contrast verification across light and dark text-and-surface pairs before export is enabled.
Continue to the Theme editor to build and download a custom DESIGN.md, CSS override file, or W3C DTCG 2025.10 JSON file.