React Data GridCustomising Colours & Fonts
react logo

Change the overall colour scheme and appearance of data.

The grid exposes many CSS --ag-*-color variables that affect the colour of elements. --ag-font-size and --ag-font-family control the default font for the grid.

Example

.ag-theme-quartz {
    --ag-foreground-color: rgb(126, 46, 132);
    --ag-background-color: rgb(249, 245, 227);
    --ag-header-foreground-color: rgb(204, 245, 172);
    --ag-header-background-color: rgb(209, 64, 129);
    --ag-odd-row-background-color: rgb(0, 0, 0, 0.03);
    --ag-header-column-resize-handle-color: rgb(126, 46, 132);

    --ag-font-size: 17px;
    --ag-font-family: monospace;
}

The above code produces these results:

Key colour variables

Some of the most important colour variables are listed below. For the full list check the full CSS variables reference - every colour variable is ends with -color.

There are a lot of colour variables - the easiest way to find the variable that colours a specific element is often to inspect the element in your browser's developer tools and check the value of its color or background-color properties.

Colour blending

The Quartz theme automatically generates semi-transparent versions of colour variables based on the ones that you define. For example if you set --ag-active-color to red then --ag-range-selection-background-color will default to a 20% opaque red.

If you're on a theme other than Quartz, you can achieve this effect yourself using the CSS color-mix() function. Here is how you would set the range selection background to a 20% opaque red when using the Alpine theme:

.ag-theme-alpine {
    --ag-range-selection-background-color: color-mix(in srgb, transparent, red 20%);
}