pub struct FreedesktopLoader<'a> { /* private fields */ }Expand description
Loader for freedesktop.org icon themes (GTK / Linux).
Honors .theme() for BOTH role-based and name-based lookups — unlike
the previous single-struct design, no dispatch layer can silently
drop the theme override.
use native_theme::icons::FreedesktopLoader;
use native_theme::theme::IconRole;
// By role, system theme:
let _icon = FreedesktopLoader::new(IconRole::ActionCopy).load();
// By name, explicit theme + size + symbolic fg color:
let _icon = FreedesktopLoader::new("edit-copy")
.theme("Adwaita")
.size(48)
.color([0, 0, 0])
.load();Implementations§
Source§impl<'a> FreedesktopLoader<'a>
impl<'a> FreedesktopLoader<'a>
Sourcepub fn new(id: impl Into<IconId<'a>>) -> Self
pub fn new(id: impl Into<IconId<'a>>) -> Self
Create a freedesktop loader. Defaults: size 24, no fg_color, system theme.
Sourcepub fn color(self, rgb: [u8; 3]) -> Self
pub fn color(self, rgb: [u8; 3]) -> Self
Set the foreground color for GTK symbolic icon colorization.
Sourcepub fn color_opt(self, rgb: Option<[u8; 3]>) -> Self
pub fn color_opt(self, rgb: Option<[u8; 3]>) -> Self
Set the foreground color if Some, leave default if None.
Sourcepub fn theme(self, theme: &'a str) -> Self
pub fn theme(self, theme: &'a str) -> Self
Override the freedesktop icon theme (e.g. “Adwaita”, “breeze”). When unset, uses the system-detected theme.
Sourcepub fn load_indicator(theme: Option<&str>) -> Option<AnimatedIcon>
pub fn load_indicator(theme: Option<&str>) -> Option<AnimatedIcon>
Load the theme’s animated process-working spinner.
theme of None uses the system-detected theme; Some(t) overrides.
Associated function (no self) — the spinner is a property of the
theme, not of any particular icon id.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for FreedesktopLoader<'a>
impl<'a> !Send for FreedesktopLoader<'a>
impl<'a> !Sync for FreedesktopLoader<'a>
impl<'a> !UnwindSafe for FreedesktopLoader<'a>
impl<'a> Freeze for FreedesktopLoader<'a>
impl<'a> Unpin for FreedesktopLoader<'a>
impl<'a> UnsafeUnpin for FreedesktopLoader<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more