Skip to main content

Crate rio_theme

Crate rio_theme 

Source
Expand description

Theme engine for rustio-admin.

The crate takes a client’s raw brand color(s) as input and emits a safe, computed tokens.css as output. The pipeline measures, repairs, derives, and adapts the raw input — the color a client hands you is not the color the UI ends up using.

Build-time only: the engine runs inside rustio-admin-cli when a developer calls rustio theme generate. Runtime CSS is the generated static file; the runtime library never depends on this crate.

Read order: colorcontrast → the six decision cases (guard, derive, vivid, semantic, adaptive, hierarchy) → engine (the orchestrator) → emit (CSS serialisation).

Re-exports§

pub use color::Color;
pub use color::ColorError;
pub use engine::resolve_theme;
pub use engine::resolve_theme_with_report;
pub use engine::ResolveReport;
pub use engine::ThemeInput;
pub use engine::ThemeTokens;

Modules§

adaptive
Case 5 — mode-adaptive brand.
color
The single value type the theme engine passes around.
contrast
WCAG 2.1 contrast primitives. Cases 1, 4, and 5 all measure against these — implement once, correctly.
derive
Case 2 — derive a full palette from one brand color.
emit
Serialise ThemeTokens into a tokens.css string.
engine
Pipeline orchestrator.
guard
Case 1 — contrast guard for text-on-surface pairings.
hierarchy
Case 6 — multi-color role assignment.
semantic
Case 4 — brand-vs-state collision resolver.
vivid
Case 3 — vivid color taming and role split.