eskimoblood/elm-color-extra/3.0.0

NOTE: this package is not compatible with Elm 0.19.1

Color.Gradient

Gradient

type alias GradientStop =
( Float, Color )

A color and a stop value that indicates where the color appears in a gradient. The stop value must be between 0 and 1.

type alias Gradient =
List GradientStop
type alias Palette =
List Color
gradient : Space -> Palette -> Int -> Palette

Create a new Palette with gradient colors from a given Palette, with a given size.

p1 : Palette
p1 =
  [ rgb 200 0 200
  , rgb 0 100 100
  , rgb 100 0 0
  ]
gradient p1 5 -- [RGBA 200 0 200 1,RGBA 100 50 150 1,RGBA 0 100 100 1,RGBA 50 50 50 1,RGBA 100 0 0 1]
gradientFromStops : Space -> Gradient -> Int -> Palette

Create a new Palette with gradient colors from a given Gradient, with a given size.

g : Gradient
g =
  [ (0, rgb 200 0 200)
  , (0.25, rgb 0 100 100)
  , (1, rgb 150 175 160)
  ]
gradientFromStops g 5 -- [RGBA 200 0 200 1,RGBA 0 100 100 1,RGBA 50 125 120 1,RGBA 100 150 140 1,RGBA 150 175 160 1]