Expand description
iced toolkit connector for native-theme.
Maps native_theme::NativeTheme data to iced’s theming system.
§Overview
This crate provides a thin mapping layer from native_theme::ThemeVariant
to iced_core::theme::Theme. The main entry point is to_theme(), which
produces a valid iced Theme with correct colors for all built-in widget
styles via iced’s Catalog system.
Widget metrics (padding, border radius, scrollbar width) are exposed as helper functions rather than through the Catalog, since iced applies these on widget instances.
§Example
use native_theme::NativeTheme;
use native_theme_iced::to_theme;
let nt = NativeTheme::preset("default").unwrap();
if let Some(variant) = nt.pick_variant(false) {
let theme = to_theme(variant, "My App");
// Use `theme` as your iced application theme
}Modules§
- extended
- Extended palette overrides from
native_theme::ThemeVariantcolors. - icons
- Icon conversion helpers for iced.
- palette
- Maps
native_theme::ThemeVariantcolors to aniced_core::theme::Palette.
Functions§
- border_
radius - Returns the standard border radius from geometry, defaulting to 4.0.
- border_
radius_ lg - Returns the large border radius from geometry, defaulting to 8.0.
- button_
padding - Returns button padding as
[horizontal, vertical]from widget metrics. - font_
family - Returns the primary UI font family name from the theme variant.
- font_
size - Returns the primary UI font size in pixels from the theme variant.
- input_
padding - Returns text input padding as
[horizontal, vertical]from widget metrics. - mono_
font_ family - Returns the monospace font family name from the theme variant.
- mono_
font_ size - Returns the monospace font size in pixels from the theme variant.
- pick_
variant Deprecated - Select light or dark variant from a
native_theme::NativeTheme, with cross-fallback. - scrollbar_
width - Returns the scrollbar width, checking geometry first, then widget metrics.
- to_
theme - Create an iced
iced_core::theme::Themefrom anative_theme::ThemeVariant.