Expand description
iced toolkit connector for native-theme.
Maps native_theme::ResolvedThemeVariant data to iced’s theming system.
§Quick Start
ⓘ
use native_theme_iced::from_preset;
let theme = from_preset("catppuccin-mocha", true)?;Or from the OS-detected theme:
ⓘ
use native_theme_iced::from_system;
let theme = from_system()?;§Manual Path
For full control over the resolve/validate/convert pipeline:
use native_theme::ThemeSpec;
use native_theme_iced::to_theme;
let nt = ThemeSpec::preset("catppuccin-mocha").unwrap();
let mut variant = nt.pick_variant(false).unwrap().clone();
variant.resolve();
let resolved = variant.validate().unwrap();
let theme = to_theme(&resolved, "My App");§Theme Field Coverage
The connector maps a subset of ResolvedThemeVariant to iced’s theming system:
| Target | Fields | Source |
|---|---|---|
Palette (6 fields) | background, text, primary, success, warning, danger | defaults.* |
Extended overrides (4) | secondary.base.color/text, background.weak.color/text | button.bg/fg, defaults.surface/foreground |
| Widget metrics | button/input padding, border radius, scrollbar width | Per-widget resolved fields |
| Typography | font family/size/weight, mono family/size/weight, line height | defaults.font.*, defaults.mono_font.* |
Per-widget geometry beyond padding/radius (e.g., min-width, disabled-opacity)
is not mapped because iced applies these via inline widget configuration,
not through the theme system. Users can read these directly from the
ResolvedThemeVariant they pass to to_theme().
Modules§
- extended
- Extended palette overrides from
native_theme::ResolvedThemeVariantfields. - icons
- Icon conversion helpers for iced.
- palette
- Maps
native_theme::ResolvedThemeVariantcolors to aniced_core::theme::Palette.
Structs§
- Resolved
Theme Variant - A fully resolved theme where every field is guaranteed populated.
- System
Theme - Result of the OS-first pipeline. Holds both resolved variants.
- Theme
Spec - A complete native theme with a name and optional light/dark variants.
- Theme
Variant - A single light or dark theme variant containing all visual properties.
Enums§
- Animated
Icon - An animated icon, either frame-based or transform-based.
- Icon
Data - Icon data returned by loading functions.
- Icon
Role - Semantic icon roles for cross-platform icon resolution.
- IconSet
- Known icon sets that provide platform-specific icon identifiers.
Traits§
- Icon
Provider - Trait for types that map icon identifiers to platform-specific names and SVG data.
- System
Theme Ext - Extension trait for converting a
SystemThemeto an iced theme.
Functions§
- border_
radius - Returns the standard border radius from the resolved theme.
- border_
radius_ lg - Returns the large border radius from the resolved theme.
- button_
padding - Returns button padding from the resolved theme as an iced
Padding. - font_
family - Returns the primary UI font family name from the resolved theme.
- font_
size - Returns the primary UI font size in logical pixels from the resolved theme.
- font_
weight - Returns the primary UI font weight (CSS 100-900) from the resolved theme.
- from_
preset - Load a bundled preset and convert it to an iced
Themein one call. - from_
system - Detect the OS theme and convert it to an iced
Themein one call. - input_
padding - Returns text input padding from the resolved theme as an iced
Padding. - line_
height - Returns the primary UI line height in logical pixels from the resolved theme.
- mono_
font_ family - Returns the monospace font family name from the resolved theme.
- mono_
font_ size - Returns the monospace font size in logical pixels from the resolved theme.
- mono_
font_ weight - Returns the monospace font weight (CSS 100-900) from the resolved theme.
- scrollbar_
width - Returns the scrollbar width from the resolved theme.
- to_
theme - Create an iced
iced_core::theme::Themefrom anative_theme::ResolvedThemeVariant.