newmana/chroma-elm/4.2.0

NOTE: the latest version is 18.2.1

Chroma.Chroma

The attempt here is to provide something similar to https://gka.github.io/chroma.js/ but also idiomatic Elm.

Definition

chroma : String -> Result String ExtColor

Given a valid hex string (6 or 3) produce an RGB Color.

scale : Nonempty ExtColor -> ( Data, Float -> ExtColor )

Return a new configuration and a function from float to color based on default values and the given colors.

domain : Nonempty Float -> Nonempty ExtColor -> ( Data, Float -> ExtColor )

Return a new configuration and a function from float to color based on default values, the given colors and domain.

distance : ExtColor -> ExtColor -> Float

Calculate the distance in RGB color space.

Calculate the distance in RGB 255 color space.

Calculate the distance in LAB color space.

Helpers

scaleDefault : ( Data, Float -> ExtColor )

Return a new configuration and a function from float to color based on default values - colors White to Black, domain 0 - 1.

scaleWith : Data -> Nonempty ExtColor -> ( Data, Float -> ExtColor )

Return a new configuration and a function from float to color based on the given configuration values and the given colors.

Nonempty Float
-> Data
-> Nonempty ExtColor
-> ( Data, Float -> ExtColor )

Return a new configuration and a function from float to color based on the given configuration values, the given colors and domain.