Skip to main content

Module palette

Module palette 

Source
Expand description

Design-token / named-color Palette.

Mirrors the libadwaita “named colors” table (https://gnome.pages.gitlab.gnome.org/libadwaita/doc/main/named-colors.html). Palette::adwaita_light and Palette::adwaita_dark ship as a built-in light/dark theme; values come from defaults-light.css / defaults-dark.css in the libadwaita sources.

Palette::root_vars turns a palette into the same HashMap<String, String> shape the CSS var() resolver in lumen-ir merges custom properties from. The runtime’s app loader (lumen-runtime, which depends on this crate, not the other way around) folds it in once at load time as the lowest-precedence :root layer - beneath the always-on UA baseline, beneath any opted-in skin, and beneath the app’s own main.css - so var(--accent-color) and friends resolve wherever a --lumen-* token does, and any layer above can still override a name it redeclares.

This is a load-time bake, the same way a skin’s own :root block is: nothing here re-runs the cascade when a Palette value changes later. Palette derives Resource so a caller can still insert one and read it back (palette.lookup("accent_color")) for its own purposes, but the runtime does not insert one automatically and does not watch Changed<Palette> - the load-time bake works for both the from-source and the precompiled-artifact run path (the latter ships with no CSS parser at all to re-run), and a live re-resolve is a separate, not-yet-built feature.

Structs§

Palette
Named-color palette modeled on libadwaita’s @accent_color, @window_bg_color, … bus. Keys are stable Adwaita role names stored as Arc<str> so repeated lookups share one allocation.