Using CSS Variables
The easiest way to create a custom theme is to extend an existing theme and override CSS variables.Color Variables
Spacing Variables
Typography Variables
Complete Example
Available CSS Variables
Colors
Colors
--ag-foreground-color- Text color--ag-background-color- Grid background--ag-header-foreground-color- Header text--ag-header-background-color- Header background--ag-disabled-foreground-color- Disabled text--ag-border-color- Border color--ag-row-hover-color- Row hover background--ag-selected-row-background-color- Selected row background
Spacing
Spacing
--ag-row-height- Default row height--ag-header-height- Header row height--ag-cell-horizontal-padding- Cell padding--ag-grid-size- Base spacing unit (4px)
Typography
Typography
--ag-font-family- Font stack--ag-font-size- Base font size--ag-header-font-size- Header font size--ag-header-font-weight- Header font weight
Borders & Effects
Borders & Effects
--ag-border-radius- Border radius--ag-borders- Enable/disable borders--ag-borders-critical- Critical borders only
Dark Mode Support
Create dark mode variants using media queries or separate classes:Best Practices
Start with a base
Extend an existing theme rather than building from scratch
Test thoroughly
Test your theme with different grid configurations and features
Consider accessibility
Ensure sufficient color contrast for readability
Document changes
Keep a list of customized variables for maintenance