plushie/prop/theme

Theme type for application appearance.

Maps to named themes supported by the Rust binary. Wire format is a lowercase string with underscores separating words. Custom themes are dictionaries that the renderer parses into an iced::Theme::custom() palette.

Types

pub type Theme {
  Light
  Dark
  Dracula
  Nord
  SolarizedLight
  SolarizedDark
  GruvboxLight
  GruvboxDark
  CatppuccinLatte
  CatppuccinFrappe
  CatppuccinMacchiato
  CatppuccinMocha
  TokyoNight
  TokyoNightStorm
  TokyoNightLight
  KanagawaWave
  KanagawaDragon
  KanagawaLotus
  Moonfly
  Nightfly
  Oxocarbon
  Ferra
  SystemTheme
  Custom(dict.Dict(String, node.PropValue))
}

Constructors

  • Light
  • Dark
  • Dracula
  • Nord
  • SolarizedLight
  • SolarizedDark
  • GruvboxLight
  • GruvboxDark
  • CatppuccinLatte
  • CatppuccinFrappe
  • CatppuccinMacchiato
  • CatppuccinMocha
  • TokyoNight
  • TokyoNightStorm
  • TokyoNightLight
  • KanagawaWave
  • KanagawaDragon
  • KanagawaLotus
  • Moonfly
  • Nightfly
  • Oxocarbon
  • Ferra
  • SystemTheme
  • Custom(dict.Dict(String, node.PropValue))

Values

pub fn background(hex: String) -> #(String, node.PropValue)

Build a custom palette entry for the page / window background.

pub fn base(t: Theme) -> #(String, node.PropValue)

Build a custom palette entry for the base theme to extend.

pub fn custom(
  name: String,
  palette: dict.Dict(String, node.PropValue),
) -> Theme

Build a custom theme palette map.

The returned dict is passed through to the Rust renderer, which uses it to construct an iced::Theme::custom() with a modified Palette.

Core seed keys: “background”, “text”, “primary”, “success”, “danger”, “warning”. Shade overrides use the pattern “family_shade” (e.g. “primary_strong”, “background_weakest”) with optional “_text” suffix for text colors. The “base” key selects a built-in theme to extend.

Unknown keys are rejected at construction time to catch typos early.

pub fn danger(hex: String) -> #(String, node.PropValue)

Build a custom palette entry for destructive or error states.

pub fn from_string(s: String) -> Result(Theme, Nil)

Parse a built-in theme from its wire-format string.

Custom themes are dictionaries on the wire, so this function does not parse “custom”.

pub fn primary(hex: String) -> #(String, node.PropValue)

Build a custom palette entry for the primary accent colour.

pub fn success(hex: String) -> #(String, node.PropValue)

Build a custom palette entry for success indicators.

pub fn system_theme_from_string(s: String) -> Result(Theme, Nil)

Parse an OS theme preference returned by GetSystemTheme or ThemeChanged.

The renderer reports raw strings here for wire compatibility. Only concrete light and dark preferences map to a Theme; “none” and unknown values return Error(Nil).

pub fn text(hex: String) -> #(String, node.PropValue)

Build a custom palette entry for the default text colour.

pub fn to_prop_value(t: Theme) -> node.PropValue

Encode a Theme to its wire-format PropValue.

pub fn to_string(t: Theme) -> String

Convert a Theme to its wire-format string representation.

pub fn warning(hex: String) -> #(String, node.PropValue)

Build a custom palette entry for warning states.

Search Document