Skip to main content

ThemeWidget

Derive Macro ThemeWidget 

Source
#[derive(ThemeWidget)]
{
    // Attributes available to this derive:
    #[theme]
    #[theme_layer]
    #[theme_inherit]
}
Expand description

Derive macro that generates a companion Resolved struct and impl blocks for theme widget types.

§Struct-level attributes

  • #[theme_layer(border_kind = "full"|"partial"|"none")] – border validation mode
  • #[theme_layer(resolved_name = "CustomName")] – override resolved struct name
  • #[theme_layer(skip_inventory)] – skip inventory::submit! for non-per-variant widgets
  • #[theme_inherit(border_kind = "full"|"full_lg"|"partial")] – border INHERITANCE mode (Phase 94-01 G6; parallel to theme_layer.border_kind which drives validation)
  • #[theme_inherit(font = "<field>")] – font field that inherits from defaults.font (repeatable: list declares item_font + header_font, dialog declares title_font + body_font)

§Field-level attributes

  • #[theme(category = "option"|"soft_option")] – field merge/validation category (default: “option”)
  • #[theme(nested, resolved_type = "ResolvedFontSpec")] – nested validated type
  • #[theme(check = "non_negative"|"positive")] – range check
  • #[theme(range = "0.0..=1.0")] – f32 range check
  • #[theme(range_u16 = "100..=900")] – u16 range check
  • #[theme(min_max_pair = "other_field")] – min/max pair validation
  • #[theme(inherit_from = "defaults.accent_color")] – uniform inheritance source from defaults