Built with ApexCharts.js, ApexSankey, ApexStock, ApexGrid
Register the brand once, on the family theme registry, then add the one
thing that registry cannot carry. ApexCharts.registerTheme,
ApexStock.registerTheme and registerTheme from apex-commons all write to
one store that every Apex product on the page shares, and ApexSankey, ApexTree,
ApexGantt and ApexMaps read it by name. What a registered name does not reach
is the Sankey canvas, which only ApexSankey's own registry paints, and ApexGrid,
which has no named themes at all.
Everything below was measured in Chromium on 2026-11-09 against apexcharts 8.8.1, apexsankey 1.14.0 and apexstock 0.6.0, by reading computed style back off the rendered SVG rather than by reading the docs. The ApexTree 2.3.0, ApexGantt 3.22.0, ApexMaps 1.3.0 and apex-grid 4.0.0 rows come from those published packages. This page first measured apexcharts 7.8.0, apexsankey 1.12.2 and apexstock 0.5.1, where a Sankey took only two keys from a chart theme and ApexStock kept its presets to itself; the sections below say what changed.
Which products read the family registry?
Six of the seven take a registered name. Two of them, ApexCharts and ApexStock, can also write one, as can registerTheme from apex-commons.
| Library | Writes to the family registry | How a registered name is referenced | What it takes from the entry |
|---|---|---|---|
| ApexCharts 8.8.1 | ApexCharts.registerTheme(name, def) | theme: { name: 'brand' } | All of ApexThemeDef: mode, palette, tokens, monochrome, accessibility |
| ApexStock 0.6.0 | ApexStock.registerTheme(name, preset) | theme: { preset: 'brand' }, or setThemePreset(name) | mode, the accent, surface, fore and grid tokens, and up and down when the entry has them |
| ApexSankey 1.14.0 | No. ApexSankey.registerTheme is a separate, Sankey-only store | theme: 'brand' | tokens.series, tokens.fore and tokens.grid |
| ApexTree 2.3.0 | No | theme: 'brand' | The entry's tokens |
| ApexGantt 3.22.0 | No | theme: 'brand' | The entry's tokens, and mode: 'dark' for the dark colours |
| ApexMaps 1.3.0 | No, and registerTheme is undefined | As a palette name, such as theme: { palette: 'brand' } | tokens.series only |
| apex-grid 4.0.0 | No. There is no global | n/a | Nothing. The grid has no named themes |
Two rows need their own sentence.
ApexSankey has two registries, and they are complementary. A family theme
carries the token roles; a SankeyTheme registered with ApexSankey.registerTheme
carries the diagram's own fields (canvasStyle, edgeOpacity, nodePalette).
Register the same name in both and both apply, in either order, with the
Sankey's own fields winning where both set a value. A SankeyTheme never
reaches the family store: after ApexSankey.registerTheme('sx', ...) the shared
registry was still empty, and a chart named 'sx' rendered exactly as a chart
with no theme.
ApexGrid is a custom element, so there is nothing to register into. It reads
the family --apx-* CSS tokens below its own --ag-* ones, and its brand hook
is still --ag-brand, which theme="tinted" mixes into the chrome surfaces.
theme="dark" on the host sets the mode, combinable as theme="dark tinted".
The ApexGrid styles and themes guide owns that
surface.
Removal is one call for everyone now. ApexCharts.unregisterTheme(name) deletes
the shared entry: a Sankey named 'brand' went back to its built-in node fill
rgb(107, 158, 206) and label rgb(33, 33, 33), and 'brand' left
ApexStock.getThemePresets(). unregisterTheme is still undefined on
ApexSankey and ApexStock, and nothing removes a name from ApexSankey's own store.
The return values still differ. ApexCharts.registerTheme returns the
ApexCharts class so it chains, ApexSankey.registerTheme returns undefined,
and ApexStock.registerTheme returns the stored preset normalised to all seven
of its keys, which is the only one of the three that tells you what it kept.
Why not register it once and pass the name?
You can, for everything except the Sankey canvas. One registration:
ApexCharts.registerTheme('brand', {
mode: 'dark',
palette: ['#7c5cff', '#00b8a9', '#ffb703'],
tokens: {
accent: '#7c5cff',
fore: '#eeeeee',
grid: '#334155',
surface: '#0b0f19',
series: ['#7c5cff', '#00b8a9', '#ffb703'],
},
})
Named on each product, that one entry gave:
| Product | Measured result |
|---|---|
Chart, theme: { name: 'brand' } | Background rgb(11, 15, 25), axis labels #eeeeee, series strokes rgba(124,92,255,0.85) and rgba(0,184,169,0.85) |
Stock chart, theme: { preset: 'brand' } | Background rgb(11, 15, 25), axis labels #eeeeee, gridlines #334155, --apx-accent: #7c5cff on the container. Candles kept the dark base's rgba(38,166,154,1) and rgba(239,83,80,1) |
Sankey, theme: 'brand' | Node fills rgb(124, 92, 255) and rgb(255, 183, 3) from tokens.series, labels rgb(238, 238, 238), node borders rgb(51, 65, 85). Canvas rgba(0, 0, 0, 0) with the inline style border: 1px solid #caced0; box-sizing: border-box, the hardcoded light chrome |
The stock chart joined the registry in 0.6.0: on apexstock 0.5.1 a preset lived
only in ApexStock's own store. 'brand' also appeared in
ApexStock.getThemePresets() straight after the chart registration.
The candle colours are the one stock-only part of a preset. An entry that carries
up and down alongside the tokens sets them: with up: '#00ff00' and
down: '#ff00ff' added to the registration above, the candles came back
rgba(0,255,0,1) and rgba(255,0,255,1). ApexThemeDef does not declare those
two keys, so in TypeScript register through registerTheme from apex-commons,
whose ApxTheme takes extra keys, or leave them out and keep the base mode's
candles.
A definition in the wrong shape still reaches nothing. Registering Sankey keys
(nodePalette, fontColor, canvasStyle) with ApexCharts.registerTheme left
a Sankey named after it identical to one with no theme: node fill
rgb(107, 158, 206), label rgb(33, 33, 33), canvas rgba(0, 0, 0, 0). The
family store holds token roles; product-specific fields belong in the product's
own registry, or in the entry only where that product documents them, as
ApexStock does for up and down.
What breaks first?
Three things, and all of them are silent. Zero console.error calls, zero
warnings and zero pageerror events were raised in any of the runs below.
Trap one: dark already means something
'dark' is one of five built-in theme names on ApexSankey 1.14.0, alongside
light, midnight, mint and sunset. It is not a registered ApexCharts
theme, and an unknown theme.name on a chart is not an error, it is a no-op.
So passing the single name 'dark' to both sends the diagram fully dark
(canvas rgb(14, 26, 35), inline style background: #0e1a23; border: 1px solid #1f2f3a; box-sizing: border-box;, labels rgb(231, 239, 244)) while the chart
does not move at all. The chart output matched a run with the name
'does-not-exist' on every value read.
Dark mode on a chart is theme.mode, which is a different option from
theme.name, and theme: { mode: 'dark' } does repaint the chart. The
dark mode dashboard resolves Light, Dark and
System once across three products and shows the surface each one paints.
Name collisions are not hypothetical, either. mint is a built-in on
ApexSankey and a built-in preset on ApexStock 0.6.0, whose six are paper,
arctic, mint, linen, rose and graphite. One string, two libraries, two
unrelated looks, no warning from either.
Trap two: near-white labels on an unpainted canvas
This is the one that reaches production. A family theme reaches a Sankey through three keys, and they are the three that make the mistake look like it worked.
Registering one key at a time with ApexCharts.registerTheme and rendering a
Sankey under that name gave:
| Key in the family entry | What it did to the Sankey |
|---|---|
tokens.fore | Became the label colour |
tokens.grid | Became the node border colour |
tokens.series | Became the node palette. On apexsankey 1.12.2 it did nothing |
tokens.accent | Nothing visible |
tokens.surface | Nothing. The canvas stayed rgba(0, 0, 0, 0) |
palette | Nothing. The Sankey reads tokens.series, not palette |
mode | Nothing |
So a dark brand whose tokens.fore is #eeeeee paints rgb(238, 238, 238)
labels onto a canvas that was never painted, which means onto whatever your page
is. Against a white body that is 1.16:1, computed from the measured label
fill and the measured backdrop. The same label against the #0b0f19 surface the
theme intended is 16.51:1, so the colour is right and only the surface is
missing. With 1.14 the nodes now take the brand palette too, so the diagram
looks even more finished than it did on 1.12.2.
That is why this survives review. Anyone building a dark theme is looking at a dark page, where 16.51:1 is exactly what they expect to see. The demo at the top of this page has that on a switch: pick "One name, chart registry only", then tick "Put the panels on the dark surface" and watch the identical registration go from unreadable to perfect without a line of code changing.
The crossover is the registry working as designed, not an accident: a named
theme's tokens rank below the --apx-* CSS tokens and above the built-in
defaults, and the Sankey reads three of them. For which CSS custom properties a
Sankey reads from the cascade, and in what order, see
the ApexSankey theming docs; for the chart's own
resolution order, the ApexCharts themes guide; and for the
order every product shares, One theme across Apex products.
Trap three: ApexStock.registerTheme replaces the shared entry
Because ApexStock now writes to the family store, registering a stock preset
under a name the charts already use replaces the charts' entry instead of adding
to it. After ApexCharts.registerTheme('brand', ...) as above, then
ApexStock.registerTheme('brand', { mode: 'dark', up, down, grid, axis, background, accent }), the stored entry held the seven preset keys and
tokens for accent, surface, fore and grid only. The palette and
tokens.series were gone:
- The chart's second series went from
rgba(0,184,169,0.85)torgba(47,165,157,0.85), which is not a brand colour. Series 1 survived only because the accent still seeds it. - The Sankey's nodes went back to the built-in
rgb(107, 158, 206), while its labels and borders stayed branded. - The stock chart looked right.
So register a name once. Put up and down in the one entry, or give the
stock preset a name of its own.
How do I register one brand across all of them?
Write the brand once as plain data, register it once on the family registry, and add the Sankey canvas in ApexSankey's own store under the same name.
// npm install apexcharts@8.8.1 apexsankey@1.14.0 apexstock@0.6.0 apex-grid@4.0.0
import ApexCharts from 'apexcharts'
import { ApexSankey } from 'apexsankey'
import ApexStock from 'apexstock'
import 'apex-grid/define'
const BRAND = {
series: ['#7c5cff', '#00b8a9', '#ffb703'],
ink: '#eeeeee',
line: '#334155',
surface: '#0b0f19',
accent: '#7c5cff',
up: '#00b8a9',
down: '#ff5a5f',
}
// 1. The family registry. One entry, read by name by the chart, the stock
// chart, the Sankey, trees, Gantt charts and maps. up and down are the
// stock chart's candles; the other products ignore them.
ApexCharts.registerTheme('brand', {
mode: 'dark',
palette: BRAND.series,
tokens: {
accent: BRAND.accent,
fore: BRAND.ink,
grid: BRAND.line,
surface: BRAND.surface,
series: BRAND.series,
},
up: BRAND.up,
down: BRAND.down,
})
// 2. ApexSankey's own registry, same name. canvasStyle is the one thing the
// family entry cannot say, and it is the key that paints the diagram.
ApexSankey.registerTheme('brand', {
canvasStyle: `background: ${BRAND.surface}; border: 1px solid ${BRAND.line};`,
tooltipTheme: 'dark',
})
// 3. No ApexStock.registerTheme('brand', ...): it writes to the same entry as
// step 1 and would replace it.
ApexStock.setApexCharts(ApexCharts)
// 4. ApexGrid has no named themes. Its brand is a CSS custom property and its
// mode is an attribute on the host: <apex-grid theme="dark tinted">.
document.documentElement.style.setProperty('--ag-brand', BRAND.accent)
// Then, three different ways to say the same word.
const chart = new ApexCharts(chartEl, {
chart: { type: 'area', height: 300 },
series: chartSeries,
theme: { name: 'brand' },
})
await chart.render()
const sankey = new ApexSankey(sankeyEl, { theme: 'brand', width: 560, height: 300 })
sankey.render({ nodes, edges })
const stock = new ApexStock(stockEl, {
chart: { height: 420 },
series: [{ name: 'ACME', data: ohlc }],
theme: { preset: 'brand' },
})
stock.render()
// The assertion. If the second line is not a colour, the Sankey half of the
// registration never happened, and nothing will have told you.
console.log(getComputedStyle(chartEl.querySelector('svg')).backgroundColor)
// rgb(11, 15, 25)
console.log(getComputedStyle(sankeyEl.querySelector('svg')).backgroundColor)
// rgba(0, 0, 0, 0) <- broken. rgb(11, 15, 25) <- correct.
Measured with steps 1 and 2 in either order, the Sankey came back with canvas
rgb(11, 15, 25), nodes from the brand palette, labels rgb(238, 238, 238) and
borders rgb(51, 65, 85). Paste the last four lines into any page that themes
both. A transparent Sankey canvas next to a painted chart canvas is the
signature of a brand whose Sankey half was never registered.
When should I do something else?
If what you want is a light and dark mode, not a brand, none of this is worth doing.
| What you want | Reach for |
|---|---|
| Light, Dark and System across a page of products | One resolver that pushes a mode, as in the dark mode dashboard. One switch, not a registration. |
| A chart that follows the operating system with no JavaScript | theme.follow: 'os' on the chart, in the themes guide |
| Colours that come from your design system's CSS | The --apx-* tokens, which rank above a named theme in every product: One theme across Apex products |
| Products that follow an Ignite UI theme | Each product's Ignite UI add-on, listed on One theme across Apex products |
| One diagram, one look, used once | An inline theme object. ApexSankey's theme accepts a SankeyTheme directly, so a name you use once buys nothing |
| Grid chrome only | --ag-brand and the theme attribute, in styles and themes |
| A stock chart only | setThemePreset(name) at runtime, in ApexStock theming |
Registering a brand is worth it when the same name has to be applied in many places, by people who will not be reading this page, and when you want one object in your codebase that every product's look is derived from.
Which plans include these?
The libraries on this page are not on one plan.
| Library | Plan |
|---|---|
| ApexCharts.js | Community and up |
| ApexGrid | Community and up |
| ApexMaps | Community and up |
| ApexSankey | Pro and up |
| ApexStock | Premium and up |
Community is the entry plan and is free only for organizations under $2M USD in annual revenue, budget or funding; at or above that threshold it is a paid licence like the others. Nothing in this family is open source, and source published on GitHub is not an open licence. Each renders in full without a licence key; where a plan is required (ApexSankey, ApexStock, and premium features elsewhere) the output is watermarked, so every measurement on this page can be reproduced before any of it matters. The pricing page has the full matrix.
One resolver pushing a mode to three products, which is the other half of this problemSee the pieces running
Reference documentation
Frequently Asked Questions
Is there one registerTheme for the whole ApexCharts family?
Yes, for named themes. Measured on apexcharts 8.8.1, apexsankey 1.14.0 and apexstock 0.6.0, ApexCharts.registerTheme, ApexStock.registerTheme and registerTheme from apex-commons all write to one store that every Apex product on the page shares, and ApexSankey, ApexTree, ApexGantt and ApexMaps read it by name. Each product names it its own way: theme: { name } on a chart, theme: { preset } on a stock chart, a bare string on a Sankey, tree or Gantt chart, and a palette name on a map. ApexSankey.registerTheme is a separate, Sankey-only store, ApexMaps 1.3.0 has no registerTheme, and apex-grid 4.0.0 has no global and no named themes. On apexcharts 7.8.0, apexsankey 1.12.2 and apexstock 0.5.1 the stock chart still kept its presets to itself.
Why does my ApexSankey diagram ignore the theme I registered?
Usually because the definition is in the wrong shape for the store it went into. The family registry holds token roles: registering Sankey keys (nodePalette, fontColor, canvasStyle) with ApexCharts.registerTheme left a Sankey named after it identical to one with no theme on apexsankey 1.14.0, with node fill rgb(107, 158, 206), label rgb(33, 33, 33) and canvas rgba(0, 0, 0, 0). Put tokens.series, tokens.fore and tokens.grid in the family entry, and the Sankey-only fields in ApexSankey.registerTheme under the same name. Both apply, in either order, with the Sankey's own fields winning where both set a value.
Why did passing theme 'dark' turn my Sankey dark but do nothing to my chart?
Because 'dark' is one of five built-in theme names on ApexSankey 1.14.0 (light, dark, midnight, mint and sunset) and is not a registered ApexCharts theme. An unknown theme.name on a chart is a no-op, not an error: the chart output matched a run named 'does-not-exist' on every value read, with zero console errors and zero pageerror events. Dark mode on a chart is theme.mode, a different option.
Why are my Sankey node labels invisible?
Because a family theme reaches a Sankey through three keys and the canvas is not one of them. Registering one key at a time with ApexCharts.registerTheme on apexsankey 1.14.0 showed tokens.fore becoming the label colour, tokens.grid the node border and tokens.series the node palette, while tokens.accent, tokens.surface, palette and mode reached nothing. So a dark brand whose tokens.fore is #eeeeee paints rgb(238, 238, 238) labels on a canvas that stayed rgba(0, 0, 0, 0), which is 1.16:1 against a white page. The same label on the #0b0f19 surface the theme intended is 16.51:1, so the colour is right and only the surface is missing. A canvasStyle registered with ApexSankey.registerTheme under the same name paints it.
How do I remove or replace a registered theme at runtime?
ApexCharts.unregisterTheme(name) deletes the shared entry, so it removes the name for every product: a Sankey named after it went back to its built-in node fill rgb(107, 158, 206) and label rgb(33, 33, 33), and the name left ApexStock.getThemePresets(). unregisterTheme is still undefined on ApexSankey 1.14.0 and ApexStock 0.6.0, and nothing removes a name from ApexSankey's own store, so there re-registering the name is the only runtime swap. Re-registering replaces the whole shared entry: ApexStock.registerTheme under a name the charts already use dropped the entry's palette and tokens.series.
How do I brand an ApexGrid or an ApexMaps map, if neither has registerTheme?
ApexMaps 1.3.0 reads the family registry without writing to it: a registered name used as a palette, such as theme: { palette: 'brand' }, takes the entry's tokens.series and nothing else. apex-grid 4.0.0 is a custom element with no global and no named themes. It reads the family --apx-* CSS tokens below its own --ag-* ones, its brand hook is the --ag-brand custom property, which theme="tinted" mixes into the chrome surfaces, and theme="dark" on the host sets the mode, combinable as theme="dark tinted". The ApexGrid styles and themes guide and the ApexMaps theming docs own those two surfaces.
Related
See the five built-in Sankey themes
The ApexSankey themes demo switches between the built-in names and a registered brand preset, with source, in the Sankey-only registry that paints the canvas a family theme cannot reach.