---
product: "AG Grid"
title: "Legacy Themes: Customising Selections"
description: "Legacy themes: customise selected row and cell appearance in your JavaScript Data Grid (v32 and earlier theming system)."
framework: javascript
version: "36.2.0"
llms: "https://www.ag-grid.com/archive/36.2.0/llms.txt"
---

# Legacy Themes: Customising Selections

Control how selected rows and cells appear.

> **Note**
>
> This page describes the grid's legacy theming system that was the default in v32 and before, for the benefit of applications that have not yet migrated to the Theming API. These themes are deprecated and will be removed in a future major version. You may want to visit the [new theming docs](https://www.ag-grid.com/archive/36.2.0/javascript-data-grid/theming-selections/) or check out the [migration guide](https://www.ag-grid.com/archive/36.2.0/javascript-data-grid/theming-migration/).

## Row Selections

When [row selection](https://www.ag-grid.com/archive/36.2.0/javascript-data-grid/row-selection/) is enabled, you can set the color of selected rows using `--ag-selected-row-background-color`. If your grid uses alternating row colours we recommend setting this to a semi-transparent colour so that the alternating row colours are visible below it.

```css
.ag-theme-quartz {
    /* bright green, 10% opacity */
    --ag-selected-row-background-color: rgb(0, 255, 0, 0.1);
}
```

#### Custom Row Selection Colour

```ts
import "ag-grid-community/styles/ag-grid.css";
import "ag-grid-community/styles/ag-theme-quartz.css";
import {
  ClientSideRowModelModule,
  ColDef,
  GridApi,
  GridOptions,
  ModuleRegistry,
  NumberEditorModule,
  NumberFilterModule,
  RowSelectionModule,
  TextEditorModule,
  TextFilterModule,
  createGrid,
  enableDevValidations,
} from "ag-grid-community";
import { IOlympicData } from "./interfaces";
import "ag-grid-community/styles/ag-grid.css";
import "ag-grid-community/styles/ag-theme-quartz.css";

if (process.env.NODE_ENV !== "production") {
  // Enable extended validations only for development
  enableDevValidations();
}

ModuleRegistry.registerModules([
  NumberEditorModule,
  TextEditorModule,
  TextFilterModule,
  NumberFilterModule,
  RowSelectionModule,
  ClientSideRowModelModule,
]);

const columnDefs: ColDef[] = [
  { field: "athlete", minWidth: 170 },
  { field: "age" },
  { field: "country" },
  { field: "year" },
  { field: "date" },
  { field: "sport" },
  { field: "gold" },
  { field: "silver" },
  { field: "bronze" },
  { field: "total" },
];

let gridApi: GridApi<IOlympicData>;

const gridOptions: GridOptions<IOlympicData> = {
  theme: "legacy",
  columnDefs: columnDefs,
  rowSelection: { mode: "multiRow" },
  defaultColDef: {
    editable: true,
    filter: true,
  },
};

const gridDiv = document.querySelector<HTMLElement>("#myGrid")!;
gridApi = createGrid(gridDiv, gridOptions);

fetch("https://www.ag-grid.com/example-assets/olympic-winners.json")
  .then((response) => response.json())
  .then((data: IOlympicData[]) => gridApi!.setGridOption("rowData", data));
```

[Live example: Custom Row Selection Colour](https://www.ag-grid.com/archive/36.2.0/examples/theming-v32-customisation-selections/custom-row-selection-color/typescript/)

## Cell Selections

[Cell selections](https://www.ag-grid.com/archive/36.2.0/javascript-data-grid/cell-selection/) can be created by clicking and dragging on the grid. Multiple overlapping range selections can be made by holding `^ Ctrl` while creating a new range outside the existing range. Copying from a selection will briefly highlight the range of cells (`^ Ctrl`+`C`). There are several variables to control the selection and highlight style:

```css
.ag-theme-quartz {
    --ag-range-selection-border-color: rgb(193, 0, 97);
    --ag-range-selection-border-style: dashed;
    --ag-range-selection-background-color: rgb(255, 0, 128, 0.1);
    /* these next 3 variables control the background colour when 2, 3 or 4+ ranges overlap,
       and should have progressively greater opacity to look realistic - see the docs below
       for the correct formulas to use */
    --ag-range-selection-background-color-2: rgb(255, 0, 128, 0.19);
    --ag-range-selection-background-color-3: rgb(255, 0, 128, 0.27);
    --ag-range-selection-background-color-4: rgb(255, 0, 128, 0.34);

    --ag-range-selection-highlight-color: rgb(60, 188, 0, 0.3);
}
```

#### Custom Range Selection Style

```ts
import "ag-grid-community/styles/ag-grid.css";
import "ag-grid-community/styles/ag-theme-quartz.css";
import {
  ClientSideRowModelModule,
  GridApi,
  GridOptions,
  ModuleRegistry,
  createGrid,
  enableDevValidations,
} from "ag-grid-community";
import {
  CellSelectionModule,
  ClipboardModule,
  ColumnMenuModule,
  ContextMenuModule,
} from "ag-grid-enterprise";
import { IOlympicData } from "./interfaces";

if (process.env.NODE_ENV !== "production") {
  // Enable extended validations only for development
  enableDevValidations();
}

ModuleRegistry.registerModules([
  ClientSideRowModelModule,
  ClipboardModule,
  ColumnMenuModule,
  ContextMenuModule,
  CellSelectionModule,
]);

let gridApi: GridApi<IOlympicData>;

const gridOptions: GridOptions<IOlympicData> = {
  theme: "legacy",
  columnDefs: [
    { field: "athlete", minWidth: 150 },
    { field: "age", maxWidth: 90 },
    { field: "country", minWidth: 150 },
    { field: "year", maxWidth: 90 },
    { field: "date", minWidth: 150 },
    { field: "sport", minWidth: 150 },
    { field: "gold" },
    { field: "silver" },
    { field: "bronze" },
    { field: "total" },
  ],
  defaultColDef: {
    flex: 1,
    minWidth: 100,
  },
  cellSelection: true,
};

const gridDiv = document.querySelector<HTMLElement>("#myGrid")!;
gridApi = createGrid(gridDiv, gridOptions);

fetch("https://www.ag-grid.com/example-assets/olympic-winners.json")
  .then((response) => response.json())
  .then((data: IOlympicData[]) => gridApi!.setGridOption("rowData", data));
```

[Live example: Custom Range Selection Style](https://www.ag-grid.com/archive/36.2.0/examples/theming-v32-customisation-selections/custom-range-selection-style/typescript/)

### Cell Selection CSS Variables

| Property | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `--ag-range-selection-border-color` | `CSS color (e.g. `red` or `#fff`)` |  |  |  |
| `--ag-range-selection-border-style` | `a CSS border style (e.g. `dotted`, `solid` or `none`)` |  |  |  |
| `--ag-range-selection-background-color` | `CSS color (e.g. `red` or `#fff`)` |  |  |  |
| `--ag-range-selection-background-color-2` | `CSS color (e.g. `red` or `#fff`)` |  |  |  |
| `--ag-range-selection-background-color-3` | `CSS color (e.g. `red` or `#fff`)` |  |  |  |
| `--ag-range-selection-background-color-4` | `CSS color (e.g. `red` or `#fff`)` |  |  |  |
| `--ag-range-selection-highlight-color` | `CSS color (e.g. `red` or `#fff`)` |  |  |  |
| `--ag-range-selection-chart-category-background-color` | `CSS color (e.g. `red` or `#fff`)` |  |  |  |
| `--ag-range-selection-chart-background-color` | `CSS color (e.g. `red` or `#fff`)` |  |  |  |
