Skip to content

Themes

Every chart is drawn from one theme: its colours, fonts, sizes, layout and axis style. Charts ships nine built-in themes, and a workspace or a host can add its own.

Built-in themes

Name For
light Calm and quiet on white, with Paul Tol's colour-blind-safe palette. The default.
dark Dark surfaces, with the Okabe and Ito palette ordered for contrast on a dark ground.
high-contrast Black on white, heavier lines and the Okabe and Ito palette, for low vision and projectors.
print Paper and PDF: white, black text and a high-contrast palette that survives greyscale.
presentation Large type and thick marks for slides at 16:9.
geist Vercel Geist light: white canvas and crisp cobalt-first categories.
geist-dark Vercel Geist dark: near-black canvas and luminous categories.
editorial-ft Financial Times paper: warm salmon ground, Oxford blue and claret.
editorial-economist The Economist's cool stone: signature blue, cyan and red.

Choosing a theme

A call takes theme by name. The order is:

  1. the theme the call names;
  2. the theme a host synced for this session with theme_sync;
  3. the plugin's configured theme option, light by default.

tools.charts.themes lists the built-in and saved themes. With a name it answers that theme's full tokens, to copy into a custom theme. With a seed of host colours it previews a synthesised theme and its paired light and dark variants, without writing a file.

Custom themes

Save a theme in the workspace with tools.charts.theme_save:

{
  "name": "acme-brand",
  "theme": { "extends": "light", "colors": { "highlight": "#0B5FFF", "positive": "#0E9F6E" } }
}

The theme is written to .charts/themes/acme-brand.json, and every later call can use theme: "acme-brand". The tokens and their contrast are checked first; a missing or unreadable pair is refused with its code before anything is written.

A theme can also come from the plugin's options, in opencode.json(c):

{
  "plugins": [
    ["github:we-the-rebel-alliance/charts-plugin#v0.0.3", { "themes": { "acme": { "extends": "light", "colors": { "highlight": "#0B5FFF" } } } }]
  ]
}

theme_save is a write with effect: "ask", so it prompts even under access: "all".

Semantic colours

A spec can name a colour by its role instead of a hex value: theme:positive, theme:negative, theme:neutral, theme:highlight, theme:background, theme:text, theme:muted, theme:grid, theme:axis and theme:categorical.<index>. The value resolves from the active theme on every render, so one spec follows every theme.

The host bridge

A host that has its own theme can pass it to the session:

  • tools.charts.theme_sync applies the host's theme to this session's renders, in memory only; it is never written to disk.
  • tools.charts.theme_get answers the theme this session resolves, if a host synced one.
  • tools.charts.theme_clear removes it.

theme_sync and theme_clear are writes with effect: "ask"; theme_get is a read. A render that names its own theme ignores the synced one.

Contrast

Every theme is checked for readable text, labels, grid lines and series colours. A custom theme that fails a pair is refused with LOW_CONTRAST and the pair's path; the built-in themes pass. accessibility labels and the accessible data table in an interactive page follow the same theme.