styles/plotly/themeTokens#
currentThemeBase()#
Whether the active theme is a dark one.
Reads data-theme-base, which every theme (built-in or plugin-provided)
stamps alongside data-theme — an id allowlist would silently mislabel
warm-paper and every plugin skin as dark.
Returns#
"light" | "dark"
currentThemeName()#
Current value of data-theme on , or 'dark' before it is set.
Returns#
string
getPlotColors()#
Resolved plot colors for the current theme. Cached; recomputed only when
data-theme changes.
Returns#
invalidatePlotColors()#
Drop all caches. Call if tokens are mutated without a data-theme flip.
Returns#
void
resolveToken()#
Resolve a single CSS custom property to a literal color string.
name may be given with or without the leading --.
Parameters#
| Parameter | Type |
|---|---|
name |
string |
fallback? |
string |
Returns#
string
resolveTokens()#
Resolve several tokens at once (single getComputedStyle pass).
Type Parameters#
| Type Parameter |
|---|
K extends string |
Parameters#
| Parameter | Type |
|---|---|
names |
Record<K, string> |
Returns#
Record<K, string>
seriesColor()#
Pick the Nth categorical color, wrapping with modulo.
Parameters#
| Parameter | Type |
|---|---|
index |
number |
Returns#
string
seriesColorAlpha()#
Same as seriesColor but tinted to alpha.
Parameters#
| Parameter | Type |
|---|---|
index |
number |
alpha |
number |
Returns#
string
themedPlotlyLayout()#
Plotly layout fragment carrying the current theme's chrome. Merge this
after the selected template so it wins over the template's baked colors.
Returns#
Layout
usePlotColors()#
Resolved plot colors, re-rendering the component when the theme changes.
Prefer this over getPlotColors() inside React components.
Returns#
withAlpha()#
Add alpha to a resolved token color. Accepts #rgb, #rrggbb,
rgb()/rgba(). Returns the input unchanged if it cannot be parsed.
Parameters#
| Parameter | Type |
|---|---|
color |
string |
alpha |
number |
Returns#
string
PlotThemeColors#
Properties#
accent#
axisFontColor#
axisLineColor#
border#
critical#
error#
gridColor#
hoverBg#
hoverBorder#
hoverFont#
idle#
info#
integrationCurve#
isDark#
True when the resolved theme is a dark one.
jLabel#
legendBg#
legendBorder#
ok#
onAccent#
onSolid#
overlayBorder#
overlayHover#
overlayScrim#
overlaySelected#
paperBg#
patternLabel#
peakLabel#
peakLabelManual#
peakLabelSelected#
plotBg#
projection#
series#
surfaceCard#
surfaceFloating#
text#
textDisabled#
textSecondary#
theme#
The theme these values were resolved for.