Skip to main content

to_theme

Function to_theme 

Source
pub fn to_theme(variant: &ThemeVariant, name: &str) -> Theme
Expand description

Create an iced iced_core::theme::Theme from a native_theme::ThemeVariant.

Builds a custom theme using Theme::custom_with_fn(), which:

  1. Maps the 6 Palette fields from native-theme colors via palette::to_palette()
  2. Generates an Extended palette, then overrides secondary and background.weak entries via extended::apply_overrides()

The resulting theme carries the mapped Palette and Extended palette. iced’s built-in Catalog trait implementations for all 8 core widgets (Button, Container, TextInput, Scrollable, Checkbox, Slider, ProgressBar, Tooltip) automatically derive their Style structs from this palette. No explicit Catalog implementations are needed.