plushie/prop/gradient

Gradient type for background fills.

Currently supports linear gradients with an angle and a list of color stops. Each stop has an offset (0.0 to 1.0) and a Color value (from prop/color).

Types

pub type Gradient {
  Gradient(angle: Float, stops: List(GradientStop))
}

Constructors

pub type GradientStop {
  GradientStop(offset: Float, color: color.Color)
}

Constructors

Values

pub fn linear(
  angle: Float,
  stops: List(GradientStop),
) -> Gradient

Create a linear gradient with the given angle and stops.

pub fn stop(offset: Float, c: color.Color) -> GradientStop

Create a gradient stop.

pub fn to_prop_value(g: Gradient) -> node.PropValue

Encode a Gradient to its wire-format PropValue.

Search Document