plushie/prop/style_map

StyleMap type for widget style overrides.

Wraps a string-keyed dictionary of PropValues. Builder functions provide a typed API for common style properties while keeping the internal representation wire-ready.

Types

pub type StyleMap {
  StyleMap(props: dict.Dict(String, node.PropValue))
}

Constructors

Values

pub fn background(sm: StyleMap, hex: String) -> StyleMap

Set the background color (hex string).

pub fn base(sm: StyleMap, hex: String) -> StyleMap

Set the base style (hex string).

pub fn border(sm: StyleMap, val: node.PropValue) -> StyleMap

Set a border PropValue (use border.to_prop_value to produce it).

pub fn disabled(sm: StyleMap, override: StyleMap) -> StyleMap

Set the disabled state override as a nested StyleMap.

pub fn focused(sm: StyleMap, override: StyleMap) -> StyleMap

Set the focused state override as a nested StyleMap.

pub fn gradient_background(
  sm: StyleMap,
  g: gradient.Gradient,
) -> StyleMap

Set the background to a gradient.

pub fn hovered(sm: StyleMap, override: StyleMap) -> StyleMap

Set the hovered state override as a nested StyleMap.

pub fn new() -> StyleMap

Create an empty style map.

pub fn pressed(sm: StyleMap, override: StyleMap) -> StyleMap

Set the pressed state override as a nested StyleMap.

pub fn set(
  sm: StyleMap,
  key: String,
  val: node.PropValue,
) -> StyleMap

Set an arbitrary property on the style map.

pub fn shadow(sm: StyleMap, val: node.PropValue) -> StyleMap

Set a shadow PropValue (use shadow.to_prop_value to produce it).

pub fn text_color(sm: StyleMap, hex: String) -> StyleMap

Set the text color (hex string).

pub fn to_prop_value(sm: StyleMap) -> node.PropValue

Encode a StyleMap to its wire-format PropValue.

Search Document