# `Plushie.Type.Gradient`
[🔗](https://github.com/plushie-ui/plushie-elixir/blob/v0.6.0/lib/plushie/type/gradient.ex#L1)

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"}
    ])

# `stop`

```elixir
@type stop() :: %{offset: float(), color: String.t()}
```

A gradient color stop with offset (0.0-1.0) and color (canonical hex string).

# `stop_color`

```elixir
@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.

# `t`

```elixir
@type t() :: %{type: String.t(), angle: number(), stops: [stop()]}
```

Gradient specification with type, angle, and color stops.

# `encode`

```elixir
@spec encode(gradient :: t()) :: t()
```

Encodes a gradient to the wire format.

# `linear`

```elixir
@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).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
