A theme is a handful of --bb-* values; everything else derives from them: a
few dozen are knobs you set and the rest are formulas. Start in the theme builder, export the light
and dark blocks, then use this page to decide which values to pin.
Agents get the same set as data: bitboss-ui/dist/ai/design-tokens.json, with a
DESIGN.md-shaped twin in design-tokens.manifest.yaml. Grep for --bb-*; there
is no --color-* or --radius-* scale to find.
Two tiers, two prefixes
The prefix tells you which tier a token belongs to, and the tiers do not mix.
--bb-* are theme tokens. Global, defined in the library's variables.css,
themable. This is the public API surface, and it is what fills the devtools
Styles panel, so it stays readable in one screen.
--*, with no prefix, are component tokens. Each component declares its own
on its root class, so set them there, never on :root
(Overriding a component token). Custom properties inherit,
and declaring them on the root class keeps a --gap set by an outer component
from leaking into an inner one.
The brand knobs
The colour knobs a theme sets. Shape, scale, motion and overlay knobs are in
the next sections, and design-tokens.json lists every one with its
values.
The brand, its accent, and what sits on them:
--bb-primary: the brand, on every fill that carries its own text: primary buttons, badges, checked controls, the selected day. Lightrgb(0 0 0), darkrgb(255 255 255).--bb-primary-fg: text and icons on primary, black or white for the fill (automatic).--bb-accent: thin marks and text on the page: the focus ring, links, tab underlines, slider and progress lines, loading strips. It follows primary until you set it (Brand and accent).--bb-primary-border: the outline of a primary plate. It follows primary; pin it when a light fill needs an edge.--bb-link-fg: the text of link-style buttons. It follows the accent; pin it when the accent does not read as copy.
Status colours:
--bb-danger: errors and destructive intent, and message text too. Lightrgb(217 59 48), darkrgb(251 113 133).--bb-danger-fg: text and icons on a danger fill, black or white for the fill (automatic).--bb-success: success toasts and indicator bubbles. Lightrgb(21 128 61), darkrgb(74 222 128).--bb-success-fg: text and icons on success, automatic.--bb-info: info toasts and indicator bubbles. Lightrgb(37 99 235), darkrgb(96 165 250).--bb-info-fg: text and icons on info, automatic.--bb-warn: warning chrome and icons. Lightrgb(240 131 88), darkrgb(245 158 11).--bb-text-warn: warning message text. Lightrgb(180 83 9), darkrgb(245 158 11).--bb-warn-fg: text on a warning fill, which is the indicator bubble.rgb(255 255 255)in both schemes.
Surfaces, text and lines:
--bb-panel: raised surfaces such as cards, inputs, popovers and dialogs. Lightrgb(255 255 255), darkrgb(49 54 56).--bb-text: the foreground. Lightrgb(0 0 0), darkrgb(255 255 255).--bb-border: hairlines; pair it with--bb-border-w. Lightrgb(212 212 216), darkrgb(82 82 91).--bb-ring-opacity: the strength of the focus ring. Light15%, dark40%.--bb-secondary-tint: how much text tints--bb-secondary. Light4%, dark6%, so a secondary field sits as far from an outline one in dark as it does in light.
Warning is two tokens, not one. --bb-warn paints borders, focus rings and
the warning icon. That is decorative reinforcement of a state the icon's shape
and the message already carry. --bb-text-warn paints the messages in the live
region, which is real text, so it keeps a 4.5:1 budget. One token dark enough for
the copy browns the chrome, which is why there are two. In dark mode amber-500
clears both budgets, so the split is a light-theme distinction only.
--bb-success and --bb-info exist for the toast and the indicator, which
ship those variants. --bb-danger is also the error message colour, so a danger
you choose must still clear 4.5:1 as 14px text on the panel.
--bb-warn-fg is the one pinned ink. White on the light salmon is 2.59:1,
and 2.15:1 on the dark amber, below budget on purpose: it only ever carries a
short number on the indicator bubble.
Text on a fill is automatic
--bb-primary-fg and the danger, success and info -fg tokens are black or
white, computed in CSS for whatever fill you set. White goes only where it
reaches 4.5:1, so every automatic label passes WCAG AA. On a mid-tone brand
(green-600, indigo-500, a mid grey) that means black text, and a light brand
gets black too. Set only --bb-primary and the labels on it stay readable.
To choose the ink yourself, pin the -fg token at every scheme root you write:
:root,
.light {
--bb-primary-fg: rgb(255 255 255);
}
:root .dark,
:root.dark {
--bb-primary-fg: rgb(255 255 255);
}
The build plugin's contrast option changes the rule app-wide.
contrast: 'optical' keeps white on every fill darker than luminance 0.30. It
reads better on mid-tones, but there white is 3:1 to 4.5:1 and fails WCAG AA for
normal-size text. For one area, put bb-contrast-optical (or
bb-contrast-wcag) on its root element.
Installation has the option.
The same pick runs on scheme roots only. A bb-theme island that retunes
--bb-primary inherits the page's ink, so pin --bb-primary-fg there too.
Brand and accent
A fill that carries its own text is the brand (--bb-primary); a thin mark or
text drawn on the page is the accent (--bb-accent). Until you set the accent it
is the brand, so nothing changes.
Set it when the brand cannot draw a line. A yellow brand on a white panel is about 1.5:1, so a yellow focus ring, link or underline almost disappears, while a yellow button with black text reads well. Keep the yellow for the fills and give the marks a colour that reads:
:root,
.light {
--bb-primary: #facc15; /* buttons, checks, selected days */
--bb-primary-fg: #000;
--bb-accent: #0047ab; /* ring, links, underlines, progress */
}
:root .dark,
:root.dark {
--bb-primary: #facc15;
--bb-primary-fg: #000;
--bb-accent: #9db4ff;
}
Pick an accent that clears 4.5:1 on --bb-panel in each scheme, since links are
text, and keep it apart from --bb-info, or a selection reads as an info
message. npx bitboss-ui check prints a note when the accent is under 3:1 on the
panel. --bb-accent-fg is the automatic ink for a fill you paint with the
accent yourself.
Derived colours
These follow the knobs on their own. A theme normally never touches them, though
any of them can be pinned, for example to hand-tune the greys. Every mix is
in oklab.
--bb-muted:--bb-text6% into--bb-panel, for static subtle fills and disabled surfaces.--bb-track:--bb-text15% into--bb-panel, for recessed control tracks such as switch and slider rails.--bb-hover:--bb-text4% into--bb-panel, the hover fill for affordances such as buttons and nav links.--bb-surface-hover:--bb-text2% into--bb-panel, the hover fill for passive surfaces such as rows and day cells.--bb-pressed:--bb-text8% into--bb-panel, the neutral pressed fill.--bb-text-muted:--bb-textat 60% opacity, for secondary text, icons and placeholders.--bb-text-faint:--bb-textat 45% opacity, for disabled foregrounds.--bb-ring:--bb-accentat--bb-ring-opacityopacity, the focus ring of every control.--bb-ring-danger: the same with--bb-danger, the focus ring in error states.--bb-ring-warn: the same with--bb-warn, the focus ring in the warning state.--bb-ring-neutral: the same with--bb-text, the focus ring of neutral variants: grey, never primary.--bb-field-border:--bb-border, the resting border of every field box. Set it to restyle all fields and nothing else.--bb-field-disabled-bg,-borderand-fg:--bb-mutedfor the fill and the frame,--bb-text45% into--bb-panelfor the value, affixes and icons of a disabled field box. Set them to restyle every disabled field at once.--bb-secondaryand its-hover,-pressed,-border,-fgand-ring: one value per state for the button plates. The same family exists foroutline,ghost,linkanddestructive, plus--bb-primary-hoverand-pressed. Pin one to retune that variant everywhere.
Some knobs sit in between. --bb-accent, --bb-primary-border and
--bb-link-fg follow another knob, and the -fg inks are picked for their
fill, until you pin them. A pin has to be repeated in every scheme block you
write, .dark included. The MCP server's
list_tokens reports each token's kind (knob, derived or
knob-tracking), so a tool can tell which names are yours to set.
Shape, scale and motion
The default of each knob is in brackets.
--bb-radius(8px): the knob, for buttons, inputs and tab strips.--bb-radius-surface(radius × 1.8): dialogs and off-canvas sheets.--bb-radius-sm(radius × 0.6, 4px floor): nested bits such as table controls and the toast close. Never above--bb-radius.--bb-border-w(1px): hairlines on plates and dividers. Give it a unit:0px, not0.--bb-ring-size(2px): the focus ring thickness.--bb-elev(flat): the resting shadow on controls, a fullbox-shadowvalue.--bb-shadow(soft, two layers): overlays such as dialogs, popovers, menus and toasts.--bb-surface-filter(none): frost on raised plates, a fullbackdrop-filtervalue.--bb-control-h(2rem): the master control height; buttons and tabs derive from it.--bb-fs(0.875rem): the master font size; component sizes derive from it.--bb-panel-p(1rem): the content padding of large surfaces.
Type and the sizes around it (control heights, the padding that frames text,
icons beside text) are rem, so they grow when a reader raises the browser's
text size. At the default 16px they are the px they read as: 2rem is 32px.
Radii, hairlines, focus rings and shadows stay px. A knob you pin in px stops
scaling with the reader.
Radius is tiered by role, not by size, and both extra tiers derive from the
one knob while staying individually pinnable. Nest concentrically with
outer radius − padding. Derive per-size ramps inside a component from
--bb-radius with multipliers, never with literals.
A glass theme sets --bb-surface-filter: blur(22px) saturate(1.8) on :root
and gives --bb-panel some transparency, or there is nothing to see through.
Overlays have knobs of their own:
--bb-overlay(rgb(0 0 0 / 0.1), dark0.5): the backdrop dim, colour and opacity in one.--bb-overlay-above(--bb-overlay): the dim under a dialog or sheet opened over another;transparentkeeps one dim under the whole stack. A dialog that replaces a member of its ownstackadds none.--bb-overlay-blur(2px): the backdrop blur, on the bottom-most backdrop only.--bb-z-overlay(10): the overlay z-index.--bb-arrow(1): popover arrows on (1) or off (0).
The input metrics (--bb-input-px, --bb-input-py, --bb-input-icon and the
rest) are in design-tokens.json. One worth knowing: --bb-input-fs-mobile
keeps field text at 16px or more on phones so iOS does not zoom on focus.
There is no font token. Components inherit the page's font-family, so set
one on body; an app that sets none renders in the browser's serif. The
optional reset (resetCss: true) sets a system-ui stack, and your own
font-family still wins.
Field text has three families of its own, all derived from --bb-fs: the label,
the description under it, and the message line under the control. The hint,
errors and warnings share that last family because they take turns in the same
place.
--bb-label-fs(--bb-fs): the label above a field;--bb-label-weightis500.--bb-description-fs(--bb-fs): field and group-row descriptions.--bb-label-fs-sm(--bb-fs− 0.125rem): inside and floating labels.--bb-description-fs-sm(--bb-fs− 0.125rem): the description under an inside label.--bb-message-fs(--bb-fs): the hint, errors and warnings.
Each family also has a -weight and a -lh token. Set a size and its line
height follows; on an island, put bb-theme on the root so the -lh formulas
re-derive there.
Library default
Smaller description and message
<template>
<div class="grid gap-6 md:grid-cols-2">
<div
v-for="column in columns"
:key="column.id"
class="grid content-start gap-3"
:class="column.island ? 'bb-theme' : undefined"
:style="column.island ? quietText : undefined"
>
<p class="m-0 text-xs font-medium text-(--bb-text-muted)">{{ column.caption }}</p>
<!-- The label keeps its own family: only the lines around it move. -->
<BbTextInput
:id="`field-text-${column.id}`"
v-model="slug"
description="Your team signs in at this address."
:errors="['This address is already taken.']"
label="Workspace URL"
:name="`workspace_url_${column.id}`"
/>
</div>
</div>
</template>
<script setup lang="ts">
import { ref } from 'vue';
import { BbTextInput } from 'bitboss-ui';
const slug = ref<string | null>('northwind');
const columns = [
{ id: 'default', caption: 'Library default', island: false },
{ id: 'quiet', caption: 'Smaller description and message', island: true },
];
// `.bb-theme` re-runs the derived formulas on this element, so each
// `-lh` line height follows its new `-fs` instead of staying at the page's.
const quietText = {
'--bb-description-fs': 'calc(var(--bb-fs) - 0.125rem)',
'--bb-message-fs': 'calc(var(--bb-fs) - 0.125rem)',
'--bb-message-weight': '500',
};
</script>
Motion is a closed ladder. --bb-transition-fast (150ms) is for
micro-interactions, --bb-transition-medium (250ms) for overlays and most moves,
and --bb-transition-slow (350ms) for large consumer surfaces. --bb-ease is
the only easing curve. Under prefers-reduced-motion the components drop every
movement (slides, zooms, scale-ins) and keep the fades.
The emphasis ladder
All tinting goes through one ladder of color-mix() percentages. No other
percentage is allowed in a mix with a semantic colour.
| Stop | Meaning | Example |
|---|---|---|
8% | Resting tint fill | Secondary button background, tab strip |
15% | Hover tint fill | Secondary and destructive button hover |
25% | Pressed or selected tint, tinted borders | aria-pressed background, danger border |
45% | Disabled foreground | Disabled button text |
60% | Muted text, which is --bb-text-muted | Secondary copy, icons |
75% | Strong but secondary foreground | Toast icon, alert secondary copy |
Two composition modes, chosen by context:
/* Opaque fill — the element owns its background. */
background: color-mix(in oklab, var(--accent) 8%, var(--bb-panel));
/* Translucent fill — it sits on an unknown background. */
background: color-mix(in oklab, var(--accent) 8%, transparent);
Solid, non-tinted surfaces darken instead: 90% toward black on hover, 80% on
active.
Every interactive component then follows one four-state progression:
- Neutral chrome: transparent at rest (
8%if filled),var(--bb-hover)on hover,var(--bb-pressed)when pressed. - Tinted variants:
8%at rest,15%on hover,25%when pressed. - Solid variants:
100%at rest,90%+ black on hover,80%+ black when pressed. - Disabled, in all three: a
var(--bb-muted)fill with the text at45%.
Focus adds box-shadow: 0 0 0 var(--bb-ring-size) var(--bb-ring) on top of the
hover values.
Grays stay gray; primary tint means selected. The tinted progression applies only to states that mean something, such as danger variants and brand-selected states. It never applies to plain interaction chrome. That single rule is what makes a yellow theme produce grey hovers and yellow selections, instead of a yellow-washed UI.
Dark mode and the page canvas
One name per token. :root and .light declare the light values, and .dark
re-declares only the knobs that change. The derived tokens follow on their
own, because their formulas are declared again at every scheme boundary.
To pin a dark value, write the library's own selector pair. The dark block is
:root .dark, :root.dark, and with the library unlayered (the default) a bare
.dark { … } in your sheet loses to it, however late it loads:
:root .dark,
:root.dark {
--bb-primary: rgb(45 212 191);
}
With cssLayers set, your unlayered sheet
outranks the layered library and a bare .dark works too. Light pins on :root
work either way.
Each scheme block also sets the UA color-scheme, and that is load-bearing.
color-scheme governs the default canvas fill of any element with no
authored background, so it always follows the class rather than
prefers-color-scheme. Otherwise a .dark document under a light OS preference
would flip --bb-text to white while the canvas underneath stayed white, making
outline and ghost buttons invisible.
You need a value only when you want a deliberately tinted, recessed canvas so white cards visibly float. That is a project decision, so mint it in project CSS. Derive it and it flips on its own:
:root {
--app-canvas: color-mix(in oklab, var(--bb-text) 3%, var(--bb-panel));
}
body {
background: var(--app-canvas);
}
One CSS mechanic to respect: a custom property resolves its var() references
where it is declared, not where it is consumed. Override a knob on an arbitrary
scope, .brand { --bb-primary: … }, and the tokens that mix from it do not
re-derive. Add the bb-theme class to that scope: it re-runs the formulas
against the knobs set there and keeps the page's scheme.
Writing a theme shows one live. Root-level theming is unaffected.
Writing a theme
A theme is two small blocks of the same ten or so declarations, one per
scheme: :root for light and shared values, :root .dark, :root.dark for dark.
Change --bb-primary, --bb-radius, --bb-control-h, --bb-panel and
--bb-danger and you have overhauled the entire library with no other edits. A
theme lives in your own CSS, not in the plugin config (the plugin has no theme
option), so changing it needs no rebuild.
Ten knobs are registered with @property. Eight are colours with
syntax: '<color>': primary, primary-fg, danger, warn, text-warn, panel, text
and border. Two are percentages with syntax: '<percentage>': --bb-ring-opacity
and --bb-secondary-tint.
Registration also makes the knobs animatable. Add .theme-animated to the
element carrying the scheme class and theme changes crossfade over
--bb-transition-medium, with every derived mix re-deriving per frame
(<html class="dark theme-animated">). The whole subtree repaints while it
runs, a deliberate cost, and that is why it is opt-in.
One area can carry its own theme. Put bb-theme on its root and set only the
knobs that change. Pick a brand and a radius below: the card retints, hover and
focus follow, and the page around it stays as it was. Pin --bb-primary-fg with
the new primary, since the island keeps the page's scheme. Sunflower also sets
--bb-accent: the link and the focused field turn cobalt, and the yellow stays
on the button and the switch.
Workspace settings
Pro plan<template>
<div class="grid gap-6 md:grid-cols-[minmax(0,14rem)_minmax(0,1fr)]">
<div class="grid content-start gap-5">
<BbRadioGroup
id="island-brand"
v-model="brandName"
:items="brands"
legend="Brand primary"
list-layout="vertical"
name="island_brand"
/>
<BbSlider id="island-radius" v-model="radius" :label="`Radius: ${radius}px`" :max="16" :min="0" name="island_radius" :step="2" />
</div>
<!--
`.bb-theme` re-runs the derived formulas against the knobs set on this
element, so hover, pressed and focus ring follow the new primary. Without
it they would stay computed from the page's own `--bb-primary`.
-->
<div class="bb-theme grid content-start gap-4 rounded-[var(--bb-radius-surface)] border border-[var(--bb-border)] bg-[var(--bb-panel)] p-[var(--bb-panel-p)]" :style="islandStyle">
<div class="flex items-center justify-between gap-2">
<p class="m-0 font-medium">Workspace settings</p>
<BbBadge variant="secondary">Pro plan</BbBadge>
</div>
<BbTextInput id="island-name" v-model="workspace" label="Workspace name" name="workspace_name" />
<BbSwitch id="island-digest" v-model="digest" label="Send a weekly digest" name="weekly_digest" />
<div class="flex flex-wrap gap-2">
<BbButton variant="primary">Save changes</BbButton>
<BbButton variant="outline">Cancel</BbButton>
<BbButton variant="link">Manage members</BbButton>
</div>
</div>
</div>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue';
import { BbBadge, BbButton, BbRadioGroup, BbSlider, BbSwitch, BbTextInput } from 'bitboss-ui';
// `fg` is pinned with each primary: the island keeps the page's scheme, so the
// text on a new primary is the one knob that does not follow on its own.
// Sunflower is a brand too light to draw a line: `accent` takes the focus
// border, the link and the ring, and the yellow stays on the fills.
const brands = [
{ label: 'Library default', value: 'default', primary: null, fg: null, accent: null },
{ label: 'Ocean', value: 'ocean', primary: '#2563eb', fg: '#ffffff', accent: null },
{ label: 'Forest', value: 'forest', primary: '#047857', fg: '#ffffff', accent: null },
{ label: 'Sunflower', value: 'sunflower', primary: '#facc15', fg: '#000000', accent: '#0047ab' },
];
const brandName = ref('ocean');
const radius = ref(8);
const workspace = ref<string | null>('Northwind Traders');
const digest = ref(true);
const islandStyle = computed(() => {
const brand = brands.find((entry) => entry.value === brandName.value);
return {
'--bb-radius': `${radius.value}px`,
...(brand?.primary ? { '--bb-primary': brand.primary, '--bb-primary-fg': brand.fg } : {}),
...(brand?.accent ? { '--bb-accent': brand.accent } : {}),
};
});
</script>
An area that also restyles parts, such as rounder buttons or smaller labels, pairs the island with a named passthrough scope.
Avatar colours
BbAvatar's color picks one of ten hues from the person's name, so the same
person gets the same colour on every page. A theme moves a hue, or the fill and
ink pair every hue shares. Each default pair clears 6:1; keep a retuned pair at
4.5:1 or above.
| Token | Light | Dark | What it sets |
|---|---|---|---|
--bb-avatar-hue-coral … --bb-avatar-hue-rose | 25 … 355 | same | The ten hues, in degrees |
--bb-avatar-bg-l / --bb-avatar-bg-c | 0.93 / 0.065 | 0.4 / 0.095 | The fill's OKLCH lightness and chroma |
--bb-avatar-ink-l / --bb-avatar-ink-c | 0.42 / 0.13 | 0.93 / 0.06 | The initials' and icon's lightness and chroma |
Overriding a component token
Component tokens are real affordances. Set one on the element that declares it:
.settings .bb-tabs-list { --list-h: 40px } retunes the tabs in one scope (an
inline style on <BbTabs> does nothing, because the inner list redeclares
--list-h). Three rules, in the order they get broken.
Override only what you render. Several components expose a per-size lookup table plus an active token that the size class re-points. Setting the whole family because you want one value silently opts you out of the size scale for variants you may start using later.
Override the per-size entry, not the active token. The size class re-resolves the active token, and it is more specific than the root class:
.bb-button {
--icon-size: var(--icon-size-md);
} /* 0,1,0 */
.bb-button--sm {
--icon-size: var(--icon-size-sm);
} /* 0,2,0 — wins */
So .bb-button { --icon-size: 12px } appears to work on default buttons and does
nothing on every size="sm" one. Set --icon-size-sm instead: the per-size
entry has no competing declaration, so it always wins.
Scope it to the component, never :root. Short names are deliberately
reused. --icon-size is read by BbButton, BbBadge and the close icon, and
--gap, --px and --h are everywhere. Hoisting one to :root retunes every
component that shares the name, which is exactly what the sealing rule exists to
prevent.
In a Tailwind v4 app, set cssLayers first, as in
Installation. Without it the library's CSS
is unlayered. It then beats Tailwind utilities, and any override you write
inside an @layer block, on every property it sets.
Reading a token outside CSS
Charts, <canvas> and WebGL do not go through the cascade. They read a token's
computed value as a string and parse it themselves, and 21 shipped --bb-*
tokens are color-mix(in oklab, …) values: --bb-text-muted,
--bb-text-faint, --bb-muted, --bb-hover, the ring families, and more.
Neither obvious read path returns something a colour parser accepts.
getPropertyValue hands back the color-mix(…) expression itself: the var()s
are filled in, the mix is not. Read a resolved color instead and
you get oklab(0.599996 …), a syntax most canvas chart libraries never learned.
Resolve it through the only thing that understands every CSS colour: an offscreen canvas.
function resolveCssColor(value: string): string {
const canvas = document.createElement('canvas');
canvas.width = canvas.height = 1;
const ctx = canvas.getContext('2d')!;
ctx.fillStyle = '#000'; // baseline: a silent no-op stays black
ctx.fillStyle = value; // the browser parses and resolves here
ctx.fillRect(0, 0, 1, 1);
const [r, g, b, a] = ctx.getImageData(0, 0, 1, 1).data;
return `rgba(${r}, ${g}, ${b}, ${(a / 255).toFixed(3)})`;
}
const muted = getComputedStyle(el)
.getPropertyValue('--bb-text-muted')
.trim();
resolveCssColor(muted);
Do it for every token a canvas consumer touches, including the plain-looking
ones. Nothing marks a token as derived from the outside, and a dashboard reaches
for --bb-text-muted and --bb-text-faint first: axis labels, legends, muted
marks.
A string read gets the token as written: getPropertyValue('--bb-control-h')
is 2rem, not 32px. Multiply by the root font size, or read a computed
property such as height from an element that uses it.
Chart series
Eight colours for chart series, in order: --bb-series-1 for the first series,
--bb-series-2 for the second, up to --bb-series-8. Text on a series fill (a
value on a stacked bar, a pie label, a legend chip) takes its
--bb-series-N-fg, black or white for that colour like every automatic label.
They are the Okabe-Ito colour-blind-safe colours, and they do not follow the
brand.
| Token | Light | Dark |
|---|---|---|
--bb-series-1 | #0072b2 | #648fff |
--bb-series-2 | #d55e00 | same |
--bb-series-3 | #cc79a7 | same |
--bb-series-4 | #009e73 | same |
--bb-series-5 | #56b4e9 | same |
--bb-series-6 | #e69f00 | same |
--bb-series-7 | #f0e442 | same |
--bb-series-8 | #606060 | #c0c0c0 |
The first four read on both panels. Series 5 to 7 are under 3:1 on white, so a
chart that uses them labels those series directly and outlines their marks (or
adds a pattern or marker shape). Never let colour carry a chart alone: name each
series next to its mark, and separate touching segments with a 1–2px gap in
--bb-panel.
SVG chart libraries take var(--bb-series-1) as is. Canvas ones need each
colour resolved with the resolveCssColor above, again when the scheme
changes:
const seriesColors = (el: Element, count: number) =>
Array.from({ length: Math.min(count, 8) }, (_, i) =>
resolveCssColor(getComputedStyle(el).getPropertyValue(`--bb-series-${i + 1}`).trim()),
);
More than eight series cannot be told apart by colour: group the rest into an
"Other" series, or split the chart. Pin any of the eight at the scheme roots to
change it; its -fg re-picks on its own.