pub enum ThemeSource {
System(ThemeMode),
MacOs(ThemeMode),
Windows(ThemeMode),
Gnome(ThemeMode),
Preset(Preset),
Custom(Box<Theme>),
}Expand description
Where the theme comes from.
Systemmatches the host OS look and is the only source that gets live OS accent/color/font injection (the native default).MacOs/Windows/Gnomeforce a specific platform look on any host (a macOS app can render a Windows menu), rendered as-authored.Presetis a built-in non-OS skin;Customis a fully hand-builtTheme.
Variants§
System(ThemeMode)
Match the host OS look; System(Auto) (the default) follows light/dark.
MacOs(ThemeMode)
Force the macOS look on any host.
Windows(ThemeMode)
Force the Windows look on any host.
Gnome(ThemeMode)
Force the GNOME/Adwaita look on any host.
Preset(Preset)
A built-in non-OS preset skin.
Custom(Box<Theme>)
A fully custom theme.
Implementations§
Source§impl ThemeSource
impl ThemeSource
Sourcepub fn injects_system(&self) -> bool
pub fn injects_system(&self) -> bool
Whether this source should receive live OS injection (accent, menu colors,
real system font) — true only for System, i.e.
when the caller asked to match their OS. Explicit family / preset /
custom themes render exactly as authored.
Sourcepub fn forced_family(&self) -> Option<OsFamily>
pub fn forced_family(&self) -> Option<OsFamily>
The OsFamily this source forces, if any — Some only for
MacOs / Windows /
Gnome; None for System/Preset/Custom.
This is the seam a platform backend uses to pick the right drawer
constructor (issue #54): when Some(family), the popup must build its
drawer with
RasterDrawer::with_forced_theme
(pins the target OS’s font) instead of
RasterDrawer::new_native
(pins the host’s font — correct only for System(..)).
Sourcepub fn resolve(&self, host: OsFamily, system_is_dark: bool) -> Theme
pub fn resolve(&self, host: OsFamily, system_is_dark: bool) -> Theme
Resolve to a concrete Theme, given the host OS family and its live
dark/light appearance (both supplied by the platform backend; the pure
layer can pass any fixed values for testing). Injection of live OS
accent/colors/font is layered on by the backend afterwards (see
injects_system).
Trait Implementations§
Source§impl Clone for ThemeSource
impl Clone for ThemeSource
Source§fn clone(&self) -> ThemeSource
fn clone(&self) -> ThemeSource
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more