pub struct Resolved {
pub variant: ResolvedTheme,
pub icon_set: IconSet,
pub icon_theme: Option<Cow<'static, str>>,
pub icon_theme_explicit: bool,
}Expand description
A theme fully resolved for a specific color mode.
Returned by Theme::resolve. Bundles everything
a UI framework needs to render a window: the picked variant’s resolved
visual properties, the theme’s icon set, and the icon theme name — each
already passed through its precedence chain.
§Icon theme precedence
The icon_theme field is filled by checking, in order:
- The picked variant’s
defaults.icon_theme(per-mode override, e.g. KDE Plasma’s"breeze"light /"breeze-dark"dark). - The parent
Theme::icon_theme(shared across light and dark). system_icon_theme()(runtime detect).
The first value that is Some wins. Where none is — the TOML states no
icon theme and detection fails — the field is None: no theme stands in,
and system_icon_theme() gives the reason.
icon_theme_explicit reports whether the
value came from the TOML (tiers 1 or 2) or from runtime detection
(tier 3) — useful for UI code that labels the theme-author’s choice as
default (X).
§Examples
use native_theme::theme::{ColorMode, Theme};
let theme = Theme::preset("material")?;
let r = theme.resolve(ColorMode::Light)?;
assert_eq!(r.icon_theme.as_deref(), Some("material"));
assert!(r.icon_theme_explicit);Fields§
§variant: ResolvedThemeThe picked variant’s fully-resolved visual properties.
icon_set: IconSetThe theme’s icon set. Falls back to
system_icon_set() when the TOML omits it.
icon_theme: Option<Cow<'static, str>>The icon theme name, resolved through the three-tier precedence
documented on the struct. None when the TOML states none and
detection fails; the app can call
system_icon_theme() for the reason.
icon_theme_explicit: booltrue if icon_theme came from the TOML (tiers 1
or 2); false if it was left to runtime system detection (tier 3),
whether or not that detection named a theme.