# Customising AdapTable Themes

Canonical page: https://www.adaptabletools.com/docs/handbook-theming-custom

- Customise the shipped **`light`** and **`dark`** themes with CSS variable overrides in your stylesheet (`--ab-*`, `--ab__*`)
- **Recommended:** tune on a live Grid with [DevTools — Theme Builder](https://www.adaptabletools.com/docs/dev-guide-support-devtools-theme-builder/index.md), then paste exported CSS into `:root.ab--theme-light` / `:root.ab--theme-dark`
- Two handbook approaches — **key theme variables** and **component variables / selectors** — each with a demo below

System themes, runtime selection, and AG Grid coordination — [Theming AdapTable UI](https://www.adaptabletools.com/docs/handbook-theming/index.md).

## Topics on this Page

| Topic                                             | Summary                                                 |
| ------------------------------------------------- | ------------------------------------------------------- |
| [Two approaches](#two-approaches)                 | Key variables vs component tuning                       |
| [Key theme variables](#key-theme-variables)       | Colours, spacing, fonts, palette                        |
| [Component variables](#component-variables)       | `--ab-cmp-*`, selectors, date picker, Expression Editor |
| [Referencing in objects](#referencing-in-objects) | `var(--ab-color-…)` in Adaptable Styles                 |

## Recommended workflow

1. Install [AdapTable DevTools](https://www.adaptabletools.com/docs/dev-guide-support-devtools/index.md) and open [Theme Builder](https://www.adaptabletools.com/docs/dev-guide-support-devtools-theme-builder/index.md) on your Grid.
2. Adjust tokens and preview Dashboard, Settings Panel, and wizards.
3. Export CSS into your app's global stylesheet (see selectors below).
4. Optionally reference the same variables in [Format Columns](https://www.adaptabletools.com/docs/handbook-column-formatting/index.md) — [Referencing Theme Variables](https://www.adaptabletools.com/docs/handbook-theming-referencing/index.md).

AdapTable provides **`light`**, **`dark`**, and **`os`** system themes. Override the variables that make up **light** and **dark** when the defaults are not quite right.

- You do **not** need to fork the theme files to achieve this
- Simply import the shipped theme and layer your overrides on `:root.ab--theme-light` and `:root.ab--theme-dark`

## Two approaches

There are two main conceptual approaches to customising an AdapTable theme:

- It is possible to choose either or both approaches in the same Theme override
- Our advice is to start with approach **1** and add **2** only where you need more control

| Approach                                 | What Changes                                     | Typical Use                                                                                                   | Examples                                                                                                                               |
| ---------------------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| **1. Key theme variables**               | Core colours, spacing, fonts, color palette      | Brand colours and typography that flow through Dashboard, toolbars, panels, and wizards                       | <small>`--ab-color-accent`<br/>`--ab-color-primary`<br/>`--ab-base-space` ... </small>                                                 |
| **2. Component variables and selectors** | Per-component variables and targeted CSS classes | Fine-tune one area — e.g. hide toolbar button, restyle wizard section, theme date picker or Expression Editor | <small>`--ab-dashboard-header__background`<br/>`--ab-cmp-datepicker__`<br/>`--ab-cmp-aql-editor__*`<br/>`.ab-OnePageWizard__…`</small> |

- You can also reference theme CSS variables in Format Columns, Conditional Styles, and other [Adaptable Styles](https://www.adaptabletools.com/docs/ui-tutorial-providing-adaptable-style/index.md)
- This includes using shipped defaults and **without** customising the theme first - see [Referencing Themes](https://www.adaptabletools.com/docs/handbook-theming-referencing/index.md)

## Key Theme Variables

AdapTable contains many CSS variables.

Typically **only a few**, usually regarding colours, fonts and spacing, are required when modifying a Theme.

For this reason, most users make changes to CSS variables incrementally and work their way up as needed.

[DevTools — Theme Builder](https://www.adaptabletools.com/docs/dev-guide-support-devtools-theme-builder/index.md) changes variables on the live Grid and exports CSS for your repository — use it before maintaining large override tables by hand.

### Theme Colours

These are the core theme colours that **differ between the `light` and `dark` themes** (i.e. the `--ab-color-*` variables that AdapTable overrides in its dark theme).

Setting these is usually all you need to create a coherent custom theme.

We show here the default AdapTable values in the `light` and `dark` Themes.

| Variable                          | Where Used                                     |                          Light                           |                               Dark                                |
| --------------------------------- | ---------------------------------------------- | :------------------------------------------------------: | :---------------------------------------------------------------: |
| --ab-color-accent                 | Back Colour in Dashboard and Panel Headers     |              |                       |
| --ab-color-accent-foreground      | Font Colour in Dashboard and Panel Headers     |           |                    |
| --ab-color-background             | App-wide background; colours most UI controls  |             |                    |
| --ab-color-foreground             | App-wide font colour used in most UI controls  |           |                    |
| --ab-color-primary                | Colour of Toolbars and Toolpanels              |           |                    |
| --ab-color-primary-foreground     | Font colour where primary colour is background |           |                    |
| --ab-color-primarylight           | Colours Dashboard and most Panels              |           |                    |
| --ab-color-primarydark            | Border colour for most UI Controls             |           |                    |
| --ab-color-card                   | Background for Cards and floating panels       |           |                    |
| --ab-color-card-foreground        | Font colour used on Cards                      |           |                    |
| --ab-color-secondary              | Secondary surfaces                             |   |           |
| --ab-color-secondary-foreground   | Font colour on secondary surfaces              |  |           |
| --ab-color-border                 | Border colour for many UI controls             |  |           |
| --ab-color-destructive            | Error states and destructive actions           |           |  |
| --ab-color-destructive-foreground | Font colour on the destructive background      |             |  |
| --ab-color-shadow                 | Colours shadows and the backdrop behind popups |  |    |

### Other Key Colours

There are a number of other core, colour-related variables that can be used when setting a theme.

All these colour variables have **the same value** in both AdapTable's `light` and `dark` themes

| Variable                            | Description                                   |                      Value                      |
| ----------------------------------- | --------------------------------------------- | :---------------------------------------------: |
| --ab-color-accentlight              | Shadow for Toggle Buttons                     |  |
| --ab-color-ring                     | Colour of the focus ring (defaults to accent) |     |
| --ab-color-warn                     | Used in Warning Messages & Notifications      |  |
| --ab-color-warn-foreground          | Font colour for Warning Messages              |    |
| --ab-color-info                     | Used in Info Messages & Notifications         |  |
| --ab-color-info-foreground          | Font colour for Info Messages                 |    |
| --ab-color-success                  | Used in Success Messages & Notifications      |  |
| --ab-color-success-foreground       | Font colour for Success Messages              |    |
| --ab-color-action-edit              | Colour of Edit Button                         |  |
| --ab-color-action-edit-foreground   | Font Colour for Edit Button                   |    |
| --ab-color-action-share             | Colour of Share Button                        |  |
| --ab-color-action-share-foreground  | Font Colour for Share Button                  |    |
| --ab-color-action-delete            | Colour of Delete Button                       |  |
| --ab-color-action-delete-foreground | Font Colour for Delete Button                 |    |
| --ab-color-action-clone             | Colour of Clone Button                        |  |
| --ab-color-action-clone-foreground  | Font Colour for Clone Button                  |    |

### Module Colours

Some AdapTable Modules paint cells with a default colour as part of a feature.

Each of these default colours has its own variable, so it can be themed separately:

- These variables are what AdapTable writes into the object (e.g. Flashing Cell or Badge)
- As a result, the object reuses the same theme variable after it is persisted and reloaded

| Variable                                         | Used for                                                                                 |                                        Default                                        |
| ------------------------------------------------ | ---------------------------------------------------------------------------------------- | :-----------------------------------------------------------------------------------: |
| --ab-color-flash-up                              | [Flashing Cell](https://www.adaptabletools.com/docs/handbook-flashing-cell/index.md) when a value rises    |             |
| --ab-color-flash-down                            | Flashing Cell when a value falls                                                         |         |
| --ab-color-flash-neutral                         | Flashing Cell for neutral value                                                          |                           |
| --ab-color-quick-search-match                    | [Quick Search](https://www.adaptabletools.com/docs/handbook-quick-search/index.md) highlight matching text |                           |
| --ab-color-quick-search-match-foreground         | Text colour of a Quick Search match                                                      |                           |
| --ab-color-quick-search-current-match            | Highlights current Quick Search match                                                    |                |
| --ab-color-quick-search-current-match-foreground | Text colour of current Quick Search match                                                |                           |
| --ab-color-badge                                 | Background of a new [Badge](https://www.adaptabletools.com/docs/handbook-styled-column-badge/index.md)     |             |
| --ab-color-badge-foreground                      | Text colour of a new Badge                                                               |  |
| --ab-color-range-default                         | Colour of a new range in Range Bar, Bullet and Ranges styled columns                     |                           |

- They are independent of the Colour Palette below
- Changing a Palette colour never changes a feature default, and vice versa

### Colour Palette

The 2 shipped Themes also contain the colours of the [Colour Palette](https://www.adaptabletools.com/docs/ui-tutorial-custom-colour-palette/index.md): `--ab-color-palette-1`, `--ab-color-palette-2`, … (32 by default).

These colours exist only to populate the Colour Picker; no AdapTable feature uses them as a default

The first 12 differ in `light` and `dark`.

- These can be categorised into 6 pairs with background and matching foreground
- They are used for error, warn, success, info, neutral, and accent respectively

|         Colour          | Typical Use                  |           Light Theme           | Dark Theme                      |
| :---------------------: | ---------------------------- | :-----------------------------: | ------------------------------- |
| `--ab-color-palette-1`  | Error / breach highlight     |  |  |
| `--ab-color-palette-2`  | Error / breach highlight     |  |  |
| `--ab-color-palette-3`  | Warning / pending highlight  |  |  |
| `--ab-color-palette-4`  | Warning / pending highlight  |  |  |
| `--ab-color-palette-5`  | Success / booked highlight   |  |  |
| `--ab-color-palette-6`  | Success / booked highlight   |  |  |
| `--ab-color-palette-7`  | Informational highlight      |  |  |
| `--ab-color-palette-8`  | Informational highlight      |  |  |
| `--ab-color-palette-9`  | Neutral / inactive highlight |  |  |
| `--ab-color-palette-10` | Neutral / inactive highlight |  |  |
| `--ab-color-palette-11` | Accent / stage highlight     |  |  |
| `--ab-color-palette-12` | Accent / stage highlight     |  |  |

Typically you will want to override **both** items in a pair

The next 20 are plain colours with the same defaults in `light` and `dark`:

|        Variable         |   Default (`light` & `dark`)    |
| :---------------------: | :-----------------------------: |
| `--ab-color-palette-13` |  |
| `--ab-color-palette-14` |  |
| `--ab-color-palette-15` |  |
| `--ab-color-palette-16` |  |
| `--ab-color-palette-17` |  |
| `--ab-color-palette-18` |  |
| `--ab-color-palette-19` |  |
| `--ab-color-palette-20` |  |
| `--ab-color-palette-21` |  |
| `--ab-color-palette-22` |  |
| `--ab-color-palette-23` |  |
| `--ab-color-palette-24` |  |
| `--ab-color-palette-25` |  |
| `--ab-color-palette-26` |  |
| `--ab-color-palette-27` |  |
| `--ab-color-palette-28` |  |
| `--ab-color-palette-29` |  |
| `--ab-color-palette-30` |  |
| `--ab-color-palette-31` |  |
| `--ab-color-palette-32` |  |

Which colours the Colour Picker offers from this list is `userInterfaceOptions.colourPickerOptions.filterColours`. Which tabs it shows, and their order, is `userInterfaceOptions.colourPickerOptions.tabs` (`Custom`, `Palette`, or both).

See the UI Guide on [providing a Custom Colour Palette](https://www.adaptabletools.com/docs/ui-tutorial-custom-colour-palette/index.md) for replacing, extending or restricting the palette

### Spacing

All spacing in AdapTable is based on the `--ab-base-space` variable.

This defaults to `4px`.

Spacing in the application is derived from this value using `calc()` (e.g. `calc(var(--ab-base-space) * 2)`).

You can uniformly adjust all spacing by overriding the value of `--ab-base-space`

### Font Sizes

AdapTable also supports a scale for font size, providing 8 different font sizes.

These are derived from `--ab-base-font-size` (which defaults to `1rem`) and are used as follows:

| Font Size        | Calculation                             | Rem Equivalent | Preview                       |
| ---------------- | --------------------------------------- | -------------- | ----------------------------- |
| --ab-font-size-0 | calc(var(--ab-base-font-size) \* 0.5)   | 0.5 rem        |  |
| --ab-font-size-1 | calc(var(--ab-base-font-size) \* 0.625) | 0.625 rem      |  |
| --ab-font-size-2 | calc(var(--ab-base-font-size) \* 0.75)  | 0.75 rem       |  |
| --ab-font-size-3 | calc(var(--ab-base-font-size) \* 0.875) | 0.875 rem      |  |
| --ab-font-size-4 | var(--ab-base-font-size)                | 1 rem          |  |
| --ab-font-size-5 | calc(var(--ab-base-font-size) \* 1.25)  | 1.25 rem       |  |
| --ab-font-size-6 | calc(var(--ab-base-font-size) \* 1.5)   | 1.5 rem        |  |
| --ab-font-size-7 | calc(var(--ab-base-font-size) \* 2.25)  | 2.25 rem       |  |

In practice only `--ab-font-size-2` and `--ab-font-size-3` are used, so are the ones you are most likely to adjust

### Font Family

By default AdapTable inherits the Font it will use.

This is done using the `--ab__font-family` CSS Variable which defaults to `inherit`.

Override this variable if you wish to specify a font to be used

**Example: Demo: Key Theme Variables**

Override core theme variables — different brand for light and dark

- This demo overrides **only key theme variables** — no component-specific selectors
- **Light** theme: teal accent, cool grey toolbars, Georgia font, slightly wider spacing, teal palette colours
- **Dark** theme: slate-blue accent with a **dark** `--ab-color-accent-foreground` (readable title on the pale header), Segoe UI font, different primary/background tones and picker colours
- Two [Module Colours](https://www.adaptabletools.com/docs/handbook-theming-custom/index.md#module-colours) are also overridden (same in both themes): `--ab-color-flash-up` is orange, `--ab-color-quick-search-match` is light brown
- Watch `github_stars` tick for the orange flash-up; Quick Search is pre-filled with "Java" so the light-brown highlight is visible immediately
- Use the **Theme** toolbar or status panel to switch between light and dark and compare the two brands
- Open **Settings Panel** to see primary/background colours on panels and wizards
- New **Format Column** → Style, then open a colour dropdown: the picker uses the branded `--ab-color-palette-*` values for the active theme

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts      [template]
  columnDefs.ts         [template]
  gridOptions.ts        [template]
  index.ts              [template]
  onAdaptableReady.ts
  rowData.ts            [template]
  styles.css            [template + shown below]
  tickingDataHelper.ts  [template]
index.html              [template]
package.json            [template]
tsconfig.json           [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Key Theme Variables',
  initialState: {
    Dashboard: {
      ModuleButtons: ['Theme', 'FormatColumn', 'QuickSearch'],
      Tabs: [
        {
          Name: 'Default',
          Toolbars: ['Theme', 'Layout', 'FormatColumn'],
        },
      ],
    },
    StatusBar: {
      StatusBars: [
        {
          Key: 'Center Panel',
          StatusBarPanels: ['Theme', 'QuickSearch'],
        },
      ],
    },
    QuickSearch: {
      QuickSearchText: 'Java',
    },
    FlashingCell: {
      FlashingCellDefinitions: [
        {
          Name: 'flashing-github-stars',
          Type: 'Change',
          Scope: {
            ColumnIds: ['github_stars'],
          },
          Rule: 'ANY_CHANGE()',
        },
      ],
    },
    Theme: {
      CurrentTheme: 'light',
    },
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          TableColumns: [
            'name',
            'language',
            'github_stars',
            'week_issue_change',
            'open_issues_count',
            'license',
            'created_at',
            'updated_at',
          ],
          Name: 'Standard Layout',
          AutoSizeColumns: true,
        },
      ],
    },
  },
};
```

**`src/styles.css`**

```css
/*
 * Demo 1 — key theme variables only (no component-specific selectors).
 * Light and dark each get a distinct brand; switch themes via the Theme toolbar.
 */

:root.ab--theme-light {
  --ab-color-accent: #0d6e6e;
  --ab-color-accent-foreground: #ffffff;

  --ab-color-primary: #dce8e8;
  --ab-color-primarylight: #eef5f5;
  --ab-color-background: #f8fbfb;

  --ab-color-palette-1: #fde8e4;
  --ab-color-palette-2: #9b3b2c;
  --ab-color-palette-3: #e4f5f5;
  --ab-color-palette-4: #0a5c5c;
  --ab-color-palette-5: #e8f4e6;
  --ab-color-palette-6: #2d6a3e;

  --ab-color-palette-17: #0d6e6e;
  --ab-color-palette-18: #134e4a;
  --ab-color-palette-19: #2dd4bf;
  --ab-color-palette-20: #99f6e4;
  --ab-color-palette-30: #c2410c;
  --ab-color-palette-32: #ea580c;

  --ab-color-flash-up: #ff8c00;
  --ab-color-quick-search-match: #d2b48c;

  --ab-base-space: 5px;
  --ab__font-family: Georgia, 'Times New Roman', serif;
}

:root.ab--theme-dark {
  --ab-color-accent: #6eb5e8;
  --ab-color-accent-foreground: #152a3d;

  --ab-color-primary: #2e3a48;
  --ab-color-primarylight: #3a4a5c;
  --ab-color-background: #3a4450;

  --ab-color-palette-1: #5c1a1a;
  --ab-color-palette-2: #ffb4a8;
  --ab-color-palette-3: #2a3548;
  --ab-color-palette-4: #c9dcf0;
  --ab-color-palette-5: #1b4332;
  --ab-color-palette-6: #95d5b2;

  --ab-color-palette-17: #6eb5e8;
  --ab-color-palette-18: #1e3a5f;
  --ab-color-palette-19: #93c5fd;
  --ab-color-palette-20: #dbeafe;
  --ab-color-palette-30: #fb7185;
  --ab-color-palette-32: #fdba74;

  --ab-color-flash-up: #ff8c00;
  --ab-color-quick-search-match: #d2b48c;

  --ab-base-space: 5px;
  --ab__font-family: 'Segoe UI', system-ui, sans-serif;
}
```

**`src/onAdaptableReady.ts`**

```ts
import {AdaptableReadyInfo} from '@adaptabletools/adaptable';
import {tickNumericData} from './tickingDataHelper';

export const onAdaptableReady = ({adaptableApi}: AdaptableReadyInfo) => {
  tickNumericData(adaptableApi, 800, ['github_stars']);
};
```

## Component Variables

Beyond the key variables above, every UI element exposes additional [CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties).

In AdapTable these are typically prefixed with `--ab-cmp-` or scoped to a surface such as `--ab-dashboard-header__background`.

You can also target AdapTable **CSS classes** (e.g. `.ab-Dashboard__title`, `.ab-OnePageWizard__section-title`) when you need layout or visibility changes that variables alone cannot express.

- We aim for comprehensive CSS-variable coverage so elements can meet bespoke requirements
- If something cannot be configured as you wish, please [contact Support](mailto:support@adaptabletools.com) and we will rectify

**Example: Demo: Component Variables & Selectors**

Lower-level variables and targeted CSS — light theme only

- This demo applies **component-level** changes on top of the shipped **light** theme (`dark` is unchanged)
- **Variables**: dashboard header background, dashboard/panel gap colours, settings popup shadow, navigation separator
- **Selectors**: italic dashboard title; overline on toolbar labels; reversed wizard footer buttons; mint/chocolate wizard and tab styling
- **Visibility**: `New` / `Clone` hidden in the Layout toolbar; `Close` / `Configure` hidden in the Export toolbar
- Open **Settings Panel** (header button) and expand **Layout** / **Export** toolbars to see the effects

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts           [template]
  styles.css           [template + shown below]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Component CSS Variables',
  initialState: {
    Dashboard: {
      Tabs: [
        {
          Name: 'Default',
          Toolbars: ['Alert', 'Layout', 'Export'],
        },
      ],
    },
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          TableColumns: [
            'name',
            'language',
            'github_stars',
            'topics',
            'license',
            'created_at',
            'has_wiki',
            'updated_at',
            'pushed_at',
            'github_watchers',
            'description',
            'open_issues_count',
            'closed_issues_count',
            'open_pr_count',
            'closed_pr_count',
            'has_projects',
            'has_pages',
            'week_issue_change',
          ],
          Name: 'Standard Layout',
          AutoSizeColumns: true,
        },
        {
          TableColumns: [
            'name',
            'language',
            'open_issues_count',
            'week_issue_change',
          ],
          Name: 'Grouped Layout',
          RowGroupedColumns: ['language'],
        },
      ],
    },
  },
};
```

**`src/styles.css`**

```css
/*
 * Demo 2 — lower-level variables and targeted selectors (light theme only).
 * These sit on top of the shipped light theme; dark is unchanged.
 */

:root.ab--theme-light {
  /* Component-scoped variables (dashboard, settings panel popup) */
  --ab-dashboard-header__background: var(--ab-color-destructive);
  --ab-dashboard__background: #e4efff;
  --ab-dashboard-gap__background: #d5e7ff;

  --ab-color-background: bisque;
  --ab-cmp-adaptable-popup__box-shadow: 2px 3px 9px 0px rgb(1 38 102 / 69%);
  --ab-cmp-adaptable-popup-navigation-list-item-separator__border: 1px dashed #000;
}

.ab-Dashboard__title {
  font-style: italic;
}

.ab-Dashboard__toolbar-title {
  text-decoration: overline;
}

.ab-Dashboard__container--Layout button[data-name='clone'] {
  display: none;
}

.ab-Dashboard__container--Layout button[data-name='new'] {
  display: none;
}

.ab-Dashboard__container--Export button[data-name='close'] {
  display: none;
}

.ab-Dashboard__container--Export button[data-name='configure'] {
  display: none;
}

.ab-Dialog .ab-WizardDialog__footer {
  flex-direction: row-reverse;
}

.ab-OnePageWizard__section-container {
  background: mintcream;
}

.ab-OnePageWizard__section-title-container {
  background: mintcream;
}

.ab-OnePageWizard__section-title {
  font-size: smaller;
  color: tomato;
}

.ab-Tabs__Tab {
  background-color: chocolate;
  text-transform: uppercase;
}

.ab-Tag {
  background-color: mintcream;
}

.ab-ValueSelector [data-name='option'] {
  background-color: mintcream;
  font-style: italic;
}

.ab-OnePageWizard__footer [data-name='finish'] {
  --ab-dashboard-header__background: mintcream;
  --ab-dashboard-header__color: #da90ff;
  border-radius: 12px;
}

.ab-Tabs__Body {
  background-color: bisque;
  border-radius: 12px;
  margin-bottom: 15px;
}

.ab-LayoutEditor__LegendLetter {
  font-weight: bold;
  background-color: mintcream;
  color: tomato;
}

.ag-header-cell-label {
  justify-content: center;
}
```

### Styling Icons

Adaptable uses inline SVG for icons, since that's very performant and doesn't require any additional download.

However, you might want to style icons differently - in this case, you can customize that through css.

Every icon has the `ab-Icon` css class, and also `ab-Icon--NAME` where `NAME` is the name of the icon.

So for example, if you want to use a background image, you can do the following:

```css
.ab-Icon--spanner path {
  visibility: hidden; /* to hide the contents of the actual SVG */
}
.ab-Icon--spanner {
  background-image: url(...);
  background-size: cover;
}
```

### Using SASS

If you author theme overrides in Sass, use **interpolation** when assigning a Sass variable to a CSS custom property — the same rule applies to any `--ab-*` variable:

```scss
$panel-header-light: #fea7ff;
$panel-header-dark: #7a4d99;

:root.ab--theme-light {
  --ab-cmp-dashboardpanel_header__background: #{$panel-header-light};
}

:root.ab--theme-dark {
  --ab-cmp-dashboardpanel_header__background: #{$panel-header-dark};
}
```

### Date Picker

One control that is often themed with **component variables** is the [Date Picker](https://www.adaptabletools.com/docs/handbook-cell-editors-date-picker/index.md).

This is used by AdapTable when editing or filtering date columns

**Example: Demo: Date Picker Variables**

Styling the Date Picker

- In this demo we provide a set of custom CSS Variables for the [Date Picker](https://www.adaptabletools.com/docs/handbook-cell-editors-date-picker/index.md)
- We provide one set for each of the AdapTable System Themes: Light and Dark

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts  [template]
  rowData.ts           [template]
  styles.css           [template + shown below]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Date Picker Variables',

  userInterfaceOptions: {
    dateInputOptions: {
      datepickerButtons: ['close', 'clear', '-', 'yesterday', 'tomorrow'],
    },
  },

  initialState: {
    Dashboard: {
      ModuleButtons: ['Theme'],
      Tabs: [
        {
          Name: 'Default',
          Toolbars: ['Theme'],
        },
      ],
    },
    Theme: {CurrentTheme: 'dark'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: [
            'name',
            'language',
            'created_at',
            'updated_at',
            'pushed_at',
            'description',
            'open_issues_count',
            'closed_issues_count',
            'open_pr_count',
          ],
          AutoSizeColumns: true,
        },
      ],
    },
  },
};
```

**`src/styles.css`**

```css
/*  Date Picker Colors */

:root.ab--theme-light {
  --ab-cmp-datepicker__background: rgb(238, 238, 238);
  --ab-cmp-datepicker__selected-color: rgb(98, 0, 255);
  --ab-cmp-datepicker__selected-text-color: rgb(255, 255, 255);
  --ab-cmp-datepicker__selected-border-radius: 30%;
  --ab-cmp-datepicker__day-border-radius: 30%;
  --ab-cmp-datepicker__border: 1px solid rgb(0, 4, 250);
  --ab-cmp-datepicker__cell-size: 40px;
}

:root.ab--theme-dark {
  --ab-cmp-datepicker__background: rgb(41, 0, 88);
  --ab-cmp-datepicker__selected-color: rgb(213, 187, 255);
  --ab-cmp-datepicker__selected-text-color: rgb(255, 255, 255);
  --ab-cmp-datepicker__selected-border-radius: 30%;
  --ab-cmp-datepicker__day-border-radius: 30%;
  --ab-cmp-datepicker__border: 1px solid rgb(0, 4, 250);
  --ab-cmp-datepicker__cell-size: 40px;
}
```

### Expression Editor

The [Expression Editor](https://www.adaptabletools.com/docs/ui-expression-editor/index.md) used to write AdapTableQL Expressions has a dedicated set of custom variables.

The colours are theme variables (`--ab-color-aql-*`) and are editable in [DevTools — Theme Builder](https://www.adaptabletools.com/docs/dev-guide-support-devtools-theme-builder/index.md); the editor chrome uses component variables (`--ab-cmp-aql-editor__*`).

#### Syntax Role Colours

The main theming variables create one colour for each syntax element in the Expression Editor:

These differ between `light` and `dark` (except punctuation, which is derived from `--ab-color-foreground`)

| Variable                         | Where Used                            |                      Light                      |                      Dark                       |
| -------------------------------- | ------------------------------------- | :---------------------------------------------: | :---------------------------------------------: |
| --ab-color-aql-token-column      | Column refs (`[colId]`, `COL('id')`)  |  |  |
| --ab-color-aql-token-function    | Function names (`SUM`, `CONCAT`, …)   |  |  |
| --ab-color-aql-token-lookup      | Lookup calls (`QUERY`, `VAR`)         |  |  |
| --ab-color-aql-token-operator    | Operators (`+`, `=`, `AND`, …)        |  |  |
| --ab-color-aql-token-number      | Number and duration literals          |  |  |
| --ab-color-aql-token-string      | String literals                       |  |  |
| --ab-color-aql-token-keyword     | Keywords (`CASE`, `WHERE`, `TRUE`, …) |  |  |
| --ab-color-aql-token-punctuation | Brackets and commas                   |      derived from `--ab-color-foreground`       |      derived from `--ab-color-foreground`       |

#### Editor UI

Most of the variables used to create the Expression Editor itself default to core theme colours and can be overridden independently:

| Variable                           | Where Used               | Default                        |
| ---------------------------------- | ------------------------ | ------------------------------ |
| --ab-cmp-aql-editor\_\_background  | Editor writing surface   | `var(--ab-color-background)`   |
| --ab-cmp-aql-editor\_\_foreground  | Default text / caret     | `var(--ab-color-foreground)`   |
| --ab-cmp-aql-editor\_\_border      | Editor border            | `var(--ab-color-primarydark)`  |
| --ab-cmp-aql-editor\_\_selection   | Text selection highlight | mix of `--ab-color-accent`     |
| --ab-cmp-aql-editor\_\_placeholder | Placeholder text         | mix of `--ab-color-foreground` |

#### Column Identity Palette

There is a set of colours used to separately identify each column in an Expression.

- When editing a Calculated Column, the square brackets for each referenced Column has its own colour
- The same colours are used in the [Formula Editor](https://www.adaptabletools.com/docs/ui-formula-editor/index.md) - with the same defaults in light and dark

| Variable             |                      Value                      |
| -------------------- | :---------------------------------------------: |
| --ab-color-aql-ref-0 |  |
| --ab-color-aql-ref-1 |  |
| --ab-color-aql-ref-2 |  |
| --ab-color-aql-ref-3 |  |
| --ab-color-aql-ref-4 |  |
| --ab-color-aql-ref-5 |  |
| --ab-color-aql-ref-6 |  |
| --ab-color-aql-ref-7 |  |

The Formula Editor also uses `--ab-color-formula-trace-source` (default `var(--ab-color-accent)`) for the outline of the calculated cell being traced, and the component variables `--ab-cmp-formula-trace__outline-width`, `--ab-cmp-formula-trace__outline-style`, `--ab-cmp-formula-trace__outline-offset` and `--ab-cmp-formula-trace__cell-tint` for the outline and tint of the referenced cells.

**Example: Expression Editor Variables**

Override Expression Editor token and chrome colours

- This demo customises Expression Editor CSS Variables for both the **light** and **dark** themes
- A live [Grid Filter](https://www.adaptabletools.com/docs/handbook-grid-filter/index.md) Expression opens automatically in the [Expression Editor](https://www.adaptabletools.com/docs/ui-expression-editor/index.md) so you can see Columns, operators, strings and numbers in the new colours
- A [Calculated Column](https://www.adaptabletools.com/docs/handbook-calculated-column/index.md) (`Popularity Score`) is also provided for editing a second Expression
- Use the **Theme** toolbar or status panel to switch light / dark and compare the two override sets

- The Grid Filter Settings Panel opens on load — note the custom Column / operator / string colours in the Expression
- Click the **Calculated Column** module button (or status panel), then edit **Popularity Score**, to see the same overrides in another Editor
- Switch Theme between light and dark to compare both override sets

Demo project (Vanilla); the files without a marker are shown below:

```text
src/
  adaptableOptions.ts
  agGridModules.ts     [template]
  columnDefs.ts        [template]
  gridOptions.ts       [template]
  index.ts             [template]
  onAdaptableReady.ts
  rowData.ts           [template]
  styles.css           [template + shown below]
index.html             [template]
package.json           [template]
tsconfig.json          [template]
```

Files marked `[template]` are the same in every demo; see the [demo template](https://www.adaptabletools.com/llms/demo-template.md#vanilla).

**`src/adaptableOptions.ts`**

```ts
import {AdaptableOptions} from '@adaptabletools/adaptable';
import {WebFramework} from './rowData';

export const adaptableOptions: AdaptableOptions<WebFramework> = {
  primaryKey: 'id',
  adaptableId: 'Expression Editor Theme Variables',
  expressionOptions: {
    editorOptions: {
      availableEditors: ['QueryBuilder', 'ExpressionEditor'],
      defaultEditor: 'ExpressionEditor',
    },
  },
  initialState: {
    Dashboard: {
      ModuleButtons: ['GridFilter', 'CalculatedColumn', 'Theme'],
      PinnedToolbars: ['Theme','GridFilter'],
    },
    StatusBar: {
      StatusBars: [
        {
          Key: 'Center Panel',
          StatusBarPanels: ['Layout', 'GridFilter', 'CalculatedColumn', 'Theme'],
        },
      ],
    },
    Theme: {CurrentTheme: 'light'},
    Layout: {
      CurrentLayout: 'Standard Layout',
      Layouts: [
        {
          Name: 'Standard Layout',
          TableColumns: [
            'name',
            'language',
            'github_stars',
            'github_watchers',
            'popularity_score',
            'updated_at',
            'open_issues_count',
            'has_wiki',
          ],
          GridFilter: {
            Expression:
              '[github_stars] > 1000 AND ([language] = "TypeScript" OR [language] = "JavaScript")',
          },
          AutoSizeColumns: true,
        },
      ],
    },
    CalculatedColumn: {
      CalculatedColumns: [
        {
          FriendlyName: 'Popularity Score',
          ColumnId: 'popularity_score',
          Expression: '[github_stars] + ([github_watchers] * 2)',
          CalculatedColumnSettings: {
            DataType: 'number',
            Filterable: true,
          },
        },
      ],
    },
  },
};
```

**`src/onAdaptableReady.ts`**

```ts
import {AdaptableReadyInfo} from '@adaptabletools/adaptable';

export const onAdaptableReady = ({adaptableApi}: AdaptableReadyInfo) => {
  setTimeout(() => {
    adaptableApi.filterApi.gridFilterApi.openUIEditorForGridFilter();
  }, 1000);
};
```

**`src/styles.css`**

```css
/* Expression Editor — syntax roles, chrome, and column-identity accents */

:root.ab--theme-light {
  --ab-color-aql-token-column: #0b5fff;
  --ab-color-aql-token-function: #7c3aed;
  --ab-color-aql-token-lookup: #0f766e;
  --ab-color-aql-token-operator: #c2410c;
  --ab-color-aql-token-number: #15803d;
  --ab-color-aql-token-string: #be123c;
  --ab-color-aql-token-keyword: #86198f;

  --ab-cmp-aql-editor__background: #f8fafc;
  --ab-cmp-aql-editor__border: #0b5fff;
  --ab-cmp-aql-editor__selection: color-mix(in srgb, #0b5fff 28%, transparent);

  --ab-color-aql-ref-0: #e11d48;
  --ab-color-aql-ref-1: #7c3aed;
  --ab-color-aql-ref-2: #059669;
  --ab-color-aql-ref-3: #d97706;
}

:root.ab--theme-dark {
  --ab-color-aql-token-column: #7dd3fc;
  --ab-color-aql-token-function: #e9d5ff;
  --ab-color-aql-token-lookup: #5eead4;
  --ab-color-aql-token-operator: #fdba74;
  --ab-color-aql-token-number: #86efac;
  --ab-color-aql-token-string: #fda4af;
  --ab-color-aql-token-keyword: #f0abfc;

  --ab-cmp-aql-editor__background: #1e293b;
  --ab-cmp-aql-editor__border: #7dd3fc;
  --ab-cmp-aql-editor__selection: color-mix(in srgb, #7dd3fc 32%, transparent);

  --ab-color-aql-ref-0: #fb7185;
  --ab-color-aql-ref-1: #c4b5fd;
  --ab-color-aql-ref-2: #6ee7b7;
  --ab-color-aql-ref-3: #fbbf24;
}
```

## Referencing in objects

[Referencing Theme Variables](https://www.adaptabletools.com/docs/handbook-theming-referencing/index.md) explains how Format Columns, Conditional Styles, and other objects use `var(--ab-color-…)` so one rule follows light and dark.

### FAQ

**Approach 1 or 2 first?**
Start with **key theme variables** for brand colours and typography; add **component variables** only where a single surface needs extra control.

**Must I override both light and dark?**
For a dual brand, yes — export or author separate blocks for `:root.ab--theme-light` and `:root.ab--theme-dark`.

**Theme Builder vs this page?**
Theme Builder is for discovery and export; this page lists variables and patterns for checked-in CSS.
