Theming Overview
Pipeline
- You define
--rs-grid-*CSS custom properties on:root - At mount time,
theme_from_css_vars()reads them from the computed style - Missing variables fall back to
Theme::light()defaults - The
Themeis passed toSceneBuilderwhich uses it for all rendering
Theme struct
The Theme struct holds all visual properties:
- Colors — background, text, borders, selection, scrollbar, hover, search
- Typography — font sizes, header bold
- Spacing — cell padding, scrollbar width and radius
See CSS Variables Reference for the complete list.
Two ways to set the theme
1. CSS variables (recommended)
Add variables to your stylesheet:
2. Programmatic Theme struct
Create a Theme directly in Rust:
To apply the theme dynamically:
Pass the theme as a signal for reactive updates:
When are variables read?
CSS variables are read once at mount time. They are not re-read on every frame. To change the theme dynamically:
Use a theme signal — the component will re-render automatically when the signal updates.
Default themes
rs-grid ships with two programmatic defaults:
See Built-in Themes for details and additional themes.