Skip to content

Theming

Diagrams follow the site’s light and dark mode. To restyle them, override tokens: CSS variables that start with --idocs-. Nothing in the renderer uses a colour that is not a token.

Pick a palette to see the same diagram restyled. The snippet under each is the only CSS involved.

HTTP request / responseData accessPersistent channel (websocket, gRPC)Queue / brokerDashed: planned
Loading diagram…
src/styles/custom.css
/* Nothing to write. The defaults follow the site theme. */

Override tokens under .idocs in src/styles/custom.css (the file the starter already loads). To style only some diagrams, scope the rule to a wrapper:

.my-team-docs .idocs {
--idocs-accent: #7a4ec4;
}
<div class="my-team-docs">
<Diagram name="checkout" />
</div>

For dark mode, add a second rule. The site sets data-theme on the page, and the renderer follows it:

.idocs {
--idocs-accent: #7a4ec4;
}
:root[data-theme='dark'] .idocs {
--idocs-accent: #b79bf0;
}
Token Used for
--idocs-bg The canvas and frame background.
--idocs-surface Cards, buttons, panels.
--idocs-surface-2 Table headers, phase bands, hover states.
--idocs-zone The fill of top-level groups.
--idocs-ink Primary text and the default line colour.
--idocs-muted Secondary text and data lines.
--idocs-line Borders and hairlines.
--idocs-tile The tile behind coloured brand logos.
--idocs-shadow The shadow under cards and panels.
Token Used for
--idocs-accent Highlights, the active step, packets, requests.
--idocs-accent-soft Soft accent backgrounds, such as a selected step.
--idocs-tunnel The tunnel edge kind.
--idocs-ok, --idocs-ok-soft Responses and success.
--idocs-warn, --idocs-warn-soft Events, planned and legacy tags.
--idocs-bad, --idocs-bad-soft Errors.
Token Meaning
--idocs-dim How faded unrelated items get while a reader focuses a box or a scenario plays. 0.5 by default; 1 turns fading off.
Token Meaning
--idocs-sans Text. Defaults to IBM Plex Sans, then the system font.
--idocs-mono The bar’s counts, step labels, the interfaces table. Defaults to IBM Plex Mono.

The starter loads IBM Plex through @fontsource/ibm-plex-sans and @fontsource/ibm-plex-mono. Change the fonts by loading your own and setting these two tokens.

Each family has two tokens: the accent and a tinted background. See colours.

If your docs site already has a palette, map the tokens to it once, and diagrams follow when you change it:

.idocs {
--idocs-accent: var(--sl-color-accent);
--idocs-ink: var(--sl-color-white);
--idocs-surface: var(--sl-color-black);
}

The full list of defaults is at the top of packages/react/src/styles.css in the repository.