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 error::ThemeResolutionError;
pub use model::AnimatedIcon;
pub use model::ButtonTheme;
pub use model::CardTheme;
pub use model::CheckboxTheme;
pub use model::ComboBoxTheme;
pub use model::DialogButtonOrder;
pub use model::DialogTheme;
pub use model::ExpanderTheme;
pub use model::FontSpec;
pub use model::IconData;
pub use model::IconProvider;
pub use model::IconRole;
pub use model::IconSet;
pub use model::IconSizes;
pub use model::InputTheme;
pub use model::LinkTheme;
pub use model::ListTheme;
pub use model::MenuTheme;
pub use model::NativeTheme;
pub use model::PopoverTheme;
pub use model::ProgressBarTheme;
pub use model::Repeat;
pub use model::ResolvedDefaults;
pub use model::ResolvedFontSpec;
pub use model::ResolvedIconSizes;
pub use model::ResolvedSpacing;
pub use model::ResolvedTextScale;
pub use model::ResolvedTextScaleEntry;
pub use model::ResolvedTheme;
pub use model::ScrollbarTheme;
pub use model::SegmentedControlTheme;
pub use model::SeparatorTheme;
pub use model::SidebarTheme;
pub use model::SliderTheme;
pub use model::SpinnerTheme;
pub use model::SplitterTheme;
pub use model::StatusBarTheme;
pub use model::SwitchTheme;
pub use model::TabTheme;
pub use model::TextScale;
pub use model::TextScaleEntry;
pub use model::ThemeDefaults;
pub use model::ThemeSpacing;
pub use model::ThemeVariant;
pub use model::ToolbarTheme;
pub use model::TooltipTheme;
pub use model::TransformAnimation;
pub use model::WindowTheme;
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
Color types and sRGB utilities.
error
Error types for theme operations.
macos
macOS platform helpers. macOS theme reader: reads semantic NSColor values with P3-to-sRGB conversion, resolves both light and dark appearance variants via NSAppearance, reads system/monospace/per-widget fonts via NSFont, text scale entries from Apple’s type scale, scrollbar overlay mode, and accessibility flags.
model
Theme data model types.
presets
Bundled theme presets. Bundled theme presets and TOML serialization API.
windows
Windows platform theme reader.

Macros§

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

Structs§

SystemTheme
Result of the OS-first pipeline. Holds both resolved variants.

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.
loading_indicator
Return the loading/spinner animation for the given icon set.
platform_preset_name
Map the current platform to its matching live preset name.
prefers_reduced_motion
Query whether the user prefers reduced motion.
system_is_dark
Detect whether the system is using a dark color scheme.

Type Aliases§

Result
Convenience Result type alias for this crate.