ICSS
A CSS-like theme engine, generative design system, and widget library for the iced GUI framework. Targets iced 0.14.

The showcase app: a live gallery of every widget and an interactive theme editor, driven by the engine.
ICSS lets you style a Rust desktop app the way you'd style a web app: write a
.icss file with classes, variables, and pseudo-states, then attach class
lists to your widgets.
let theme = load?;
button.style;
See it rendered:
docs/preview.htmlis a single-file visual mockup. Open it in any browser to see the widgets styled by ICSS alongside the Rust +.icsssource that produces them.
Why
iced's native styling API is closure-based: every widget takes a
Fn(&Theme, Status) -> Style. That works, but in a real app you end up:
- repeating the same style closures across files
- hardcoding colours and radii inline
- forking the closure for every variant (primary/danger/small/disabled…)
ICSS replaces that with the model people already know from the web (class lists, variables, pseudo-states) without bringing in a browser. Themes are plain text files that can be hot-reloaded.
Layout
This is a Cargo workspace with one library crate and one showcase app.
| Path | Crate | Description |
|---|---|---|
crates/icss |
icss |
The library, three modules below |
apps/showcase |
icss-showcase |
Live component gallery + interactive theme editor |
The icss crate has three modules:
icss::theme: parses.icssand resolves widget styles for iced.icss::engine: generative design system. Produces a complete.icsstheme from a handful of base variables (OKLCH tonal palettes, dimensional tokens, semantic light/dark mapping).icss::widgets: theme-aware iced widgets that don't ship in core:DataTable,TileGrid,ButtonGroup,ControlGroup,IconInput,StickySection, and a tabbedTabBar.
The theme file
.icss is a CSS subset. The grammar is tiny: :root { --vars }, class
selectors with conjunction, five pseudo-classes (:hover, :active,
:focus, :disabled, :checked), and standard properties
(background-color, color, border-radius, padding, box-shadow,
font-size, font-weight).
}
}
}
}
}
}
}
}
Classes compose conjunctively, just like HTML: ["button", "primary", "small"]
activates rules from .button, .primary, .small, .button.primary, and
so on.
The Rust side
Load the theme once, then attach class lists to widgets.
use ;
let t = load?;
// Buttons
button.style;
button.style;
button.style;
// Text input
text_input
.style
.on_input;
// Checkbox
checkbox
.label
.on_toggle
.style;
// Typography
t.text;
t.text;
// Layout
t.column
.push
.push
.push;
Sizing tokens
For widgets where font size, padding, and gap need to agree (text input, pick list, checkbox label), use the size tokens:
let md = t.sizing; // → font_size, pad_v, pad_h, gap, min_width
let sm = t.sizing;
let xs = t.sizing;
text_input
.size
.padding
.style;
This keeps a 12px input from being paired with 16px text inside it.
A complete mini-form
No style closures and no inline magic numbers left in the view code.
Component catalog (excerpt)
| Widget | Helper | Common classes |
|---|---|---|
| Button | t.button(&[…]) |
button, primary, success, danger, warning, default, ghost, small, tiny, pill, round |
| Container | t.container(&[…]) |
page, section, section-body, page-body |
| Text input | t.text_input(&[…]) |
input, sz-xs/sz-sm/sz-md, error |
| Checkbox | t.checkbox(&[…]) |
checkbox, sz-xs/sz-sm/sz-md |
| Toggler | t.toggler(&[…]) |
toggle |
| Radio | t.radio(&[…]) |
radio |
| Slider | t.slider(&[…]) |
slider |
| Progress | t.progress_bar(&[…]) |
progress, success, danger, warning |
| Pick list | t.pick_list(&[…]) + t.menu(&[…]) |
select / select-menu + sz-* |
| Scrollable | t.scrollable(&[…]) |
scroll |
| Rule | t.rule(&[…]) |
divider |
| Text | t.text(&[…]) |
headline-large … body-micro, caption, text-soft, text-danger, … |
| Row / Column | t.row(&[…]), t.column(&[…]) |
row, row-tight, row-loose, stack, stack-tight, stack-loose, cluster |
The full catalog with every class, modifier, and pseudo-state is in
docs/COMPONENT-CATALOG.md.
Generative themes
If you don't want to hand-author a .icss file, icss::engine will produce
one from a small set of base variables:
- a brand hue + a few accents (success/danger/warning), expanded into OKLCH tonal palettes
- one dimensional scale (
--space-100,--radius-100,--font-100…), derived from a base size and ratio - light/dark surface mapping
let output = generate;
let theme = load?;
The output is a regular .icss string you can apply as-is or tweak further.
Showcase app
A live gallery of every widget plus an interactive theme editor. Change a base colour and the whole system updates. The "Save .icss" toggle in the tab bar controls whether edits are written to disk.
Documentation
docs/preview.html: visual mockup of the rendered widgets (open in a browser)docs/ICSS.md:.icsssyntax specificationdocs/COMPONENT-CATALOG.md: full class referencedocs/theme-creation.md: design-system architecturedocs/SHOWCASE.md: showcase app architecture
Toolchain
- iced 0.14 (wgpu backend)
- Rust edition 2024, MSRV 1.88
- Pure parser and style resolver. No browser engine or JS runtime.
License
MIT. See LICENSE.