Gradient backgrounds for container widgets.
Used via the background prop on containers. The renderer parses
gradient maps and converts them to iced::gradient::Linear.
Wire format
%{
type: "linear",
angle: 45,
stops: [
%{offset: 0.0, color: "#ff0000"},
%{offset: 1.0, color: "#0000ff"}
]
}angle is in degrees (converted to radians by the renderer).
Example
gradient = Plushie.Type.Gradient.linear(90, [
{0.0, "#ff0000"},
{0.5, "#00ff00"},
{1.0, "#0000ff"}
])
Summary
Types
A gradient color stop with offset (0.0-1.0) and color (canonical hex string).
Color input for gradient stops: any Color.input() form, or a float RGBA map.
Gradient specification with type, angle, and color stops.
Functions
Encodes a gradient to the wire format.
Creates a linear gradient with an angle (degrees) and a list of
{offset, color} stops. Colors accept any form Color.cast/1
supports (hex strings or named atoms).
Types
A gradient color stop with offset (0.0-1.0) and color (canonical hex string).
@type stop_color() :: Plushie.Type.Color.input() | %{r: float(), g: float(), b: float(), a: float()}
Color input for gradient stops: any Color.input() form, or a float RGBA map.
Gradient specification with type, angle, and color stops.
Functions
Encodes a gradient to the wire format.
@spec linear(angle :: number(), stops :: [{number(), stop_color()}]) :: t()
Creates a linear gradient with an angle (degrees) and a list of
{offset, color} stops. Colors accept any form Color.cast/1
supports (hex strings or named atoms).