Skip to main content

ThemeSource

Enum ThemeSource 

Source
pub enum ThemeSource {
    System(ThemeMode),
    MacOs(ThemeMode),
    Windows(ThemeMode),
    Gnome(ThemeMode),
    Preset(Preset),
    Custom(Box<Theme>),
}
Expand description

Where the theme comes from.

  • System matches the host OS look and is the only source that gets live OS accent/color/font injection (the native default).
  • MacOs / Windows / Gnome force a specific platform look on any host (a macOS app can render a Windows menu), rendered as-authored.
  • Preset is a built-in non-OS skin; Custom is a fully hand-built Theme.

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

Source

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.

Source

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(..)).

Source

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

Source§

fn clone(&self) -> ThemeSource

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ThemeSource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ThemeSource

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,

Source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.