Skip to main content

Crate native_theme

Crate native_theme 

Source
Expand description

§native-theme

Cross-platform native theme detection and loading for Rust GUI applications.

Any Rust GUI app can look native on any platform by loading a single theme file or reading live OS settings, without coupling to any specific toolkit.

Re-exports§

pub use color::Rgba;
pub use error::Error;
pub use model::IconData;
pub use model::IconProvider;
pub use model::IconRole;
pub use model::IconSet;
pub use model::NativeTheme;
pub use model::ThemeColors;
pub use model::ThemeFonts;
pub use model::ThemeGeometry;
pub use model::ThemeSpacing;
pub use model::ThemeVariant;
pub use model::WidgetMetrics;
pub use model::bundled_icon_by_name;
pub use model::bundled_icon_svg;
pub use model::icons::icon_name;
pub use model::icons::system_icon_set;
pub use model::icons::system_icon_theme;

Modules§

color
error
macos
macOS theme reader: reads semantic NSColor values with P3-to-sRGB conversion, resolves both light and dark appearance variants via NSAppearance, and reads system and monospace fonts via NSFont.
model
presets
Bundled theme presets and TOML serialization API.

Macros§

impl_merge
Generates merge() and is_empty() methods for theme structs.

Enums§

LinuxDesktop
Desktop environments recognized on Linux.

Functions§

detect_linux_de
Parse XDG_CURRENT_DESKTOP (a colon-separated list) and return the recognized desktop environment.
from_system
Read the current system theme, auto-detecting the platform and desktop environment.
from_system_async
Async version of from_system() that uses D-Bus portal backend detection to improve desktop environment heuristics on Linux.
load_custom_icon
Load an icon from any IconProvider, dispatching through the standard platform loading chain.
load_icon
Load an icon for the given role using the specified icon set.
load_system_icon_by_name
Load a system icon by its platform-specific name string.
system_is_dark
Detect whether the system is using a dark color scheme.

Type Aliases§

Result
Convenience Result type alias for this crate.