#Theming
Adaptable DataGrid ships one design-token sheet — CSS custom properties prefixed
--ab-* — plus a light and a dark theme that are designed, not derived. Everything
you see (surfaces, borders, selection, focus rings, dashboard chrome) reads from
those tokens, so re-branding is a matter of overriding variables, never selectors.
#Light, dark and auto
The current theme is plain state:
adaptableApi.themeApi.setTheme('dark'); // 'light' | 'dark' | 'auto'light/darkforce a theme by applying the theme classes ondocument.documentElement.auto(the default) follows the OSprefers-color-scheme— with no JS involved: the dark token values also ship behind a media query.
This documentation site works the same way: the toggle in the header flips a
data-theme attribute and the ADG theme classes together, so every grid on the
page — including the live demos — follows along.
#Accent colors
The accent is state too — state.theme.currentAccentColor — and persists with the
rest of it. Picking one re-tints the accent, its subtle background tint, the focus
ring and selection together, in both light and dark themes:
adaptableApi.themeApi.setAccentColor('violet'); // any id from getAvailableAccentColors()
adaptableApi.themeApi.setAccentColor(null); // back to the theme's built-in accentSeven curated accents ship with the grid, built on
Radix Colors solids so they hold up on both light
and dark surfaces. Replace the list with your own through
state.theme.availableAccentColors — a color, a label and, for light accents, the
text color to use on top:
const defaultState: AdaptableUserState = {
view: { currentViewId: 'default', views: [{ id: 'default', label: 'Default' }] },
theme: {
availableAccentColors: [
{ id: 'brand', label: 'Brand', color: '#1d4ed8' },
{ id: 'sun', label: 'Sun', color: '#ffc53d', foreground: '#4f3422' },
],
currentAccentColor: 'brand',
},
};Under the hood the grid sets data-ab-accent="<id>" on the document element and
writes the accent's colors as --ab-accent-preset / --ab-accent-preset-foreground
inline, so custom accents need no CSS of their own. The same picker is available
as the Theme page of <adaptable-settings-panel>, or on its own as
<adaptable-theme-manager> (ThemeManager).
#Custom tokens
For deeper branding, override the tokens directly — they cascade like any CSS custom property:
:root {
--ab-color-accent: #6e56cf;
--ab-color-accent-foreground: #fff;
--ab-border-radius: 6px;
--ab-grid-row-height: 32px;
}The full token reference is coming to this site; until then,
@adaptabletools/tokens/vars.css is the single source of truth.
#Color picker
The color fields in the settings panel (cell styles, alerts, dashboard) open a
picker with two tabs: Custom (a free picker with opacity) and Palette
(the theme colors plus the palette colors), above a hex field and, where the
browser has one, an eyedropper. A color picked from the Palette tab is stored
as its variable, e.g. var(--ab-color-palette-3), so it follows the light and
dark themes.
The palette is every --ab-color-palette-N the theme defines, from 1 upwards
until one is missing — override or add them like any other token. Three
optional variables, not set by default, configure the picker:
| Variable | Values | Effect |
|---|---|---|
--ab-cmp-color-picker__palette-count | a number | Offers only the first N palette colors |
--ab-cmp-color-picker__allowed-colors | any (default), predefined, palette | predefined drops the Custom tab, so no custom color can be picked; palette also drops the theme colors |
--ab-cmp-color-picker__tabs | precise, colors (or colours) | The tabs shown, in order; the first one is the tab the picker opens on. One tab hides the tab bar. Default: precise colors |
:root {
/* open on the Palette tab, with Custom second */
--ab-cmp-color-picker__tabs: colors precise;
--ab-cmp-color-picker__palette-count: 12;
}Once a user picks a tab, every picker on the page opens on it until the page reloads.