The attempt here is to provide something similar to Chroma.js but also has more features and is idiomatic Elm.
Given a color turn it into a W3CX11 Color name or fall back to RGB string.
Types.RGBAColor (Color.rgb255 255 0 255) |> Chroma.name
--> Ok "magenta" : Result String StringMix two colors, first converting them to the same color space and then interpolate with the given ratio.
Chroma.mix Types.RGBA 0.25 (Types.RGBAColor W3CX11.red) (Types.RGBAColor W3CX11.blue)
--> RGBAColor (RgbaSpace 0.75 0 0.25 1) : Types.ExtColorMix two colors defined as a string, first converting them to the same color space mode and then interpolate with the given ratio.
Chroma.mixChroma Types.RGBA 0.25 "red" "blue"
--> Ok (RGBAColor (RgbaSpace 0.75 0 0.25 1)) : Result String Types.ExtColorFind the average of a non-empty list of colors, first converting them to the same color space.
Only supports RGBA, CYMK and LAB.
Chroma.average Types.RGBA (Nonempty.Nonempty (Types.RGBAColor W3CX11.red) [(Types.RGBAColor W3CX11.blue)])
--> Ok (RGBAColor (RgbaSpace 0.5 0 0.5 1)) : Result String Types.ExtColorFind the average of a non-empty list of colors defined as strongs, first converting them to the same color space.
Only supports RGBA, CYMK and LAB.
Chroma.averageChroma Types.RGBA (Nonempty.Nonempty "red" ["blue"])
--> Ok (RGBAColor (RgbaSpace 0.5 0 0.5 1)) : Result String Types.ExtColorCalculate the distance for a given color space.
Chroma.distance Types.RGBA (Types.RGBAColor W3CX11.red) (Types.RGBAColor W3CX11.blue)
--> 1.4142135623730951 : FloatCalculate the distance in RGB 255 color space.
Chroma.distance255 (Types.RGBAColor W3CX11.red) (Types.RGBAColor W3CX11.blue)
--> 360.62445840513925 : FloatCreate breaks/classes based on the data given.
Supports: CkMean (a variant of kmeans), Equal, Logarithmic, and Quantile.
Chroma.limits Limits.Equal 5 (Nonempty.Nonempty 0 [ 10 ])
--> Nonempty 0 [2,4,6,8,10] : Nonempty.Nonempty Float
Chroma.limits Limits.CkMeans 3 (Nonempty.Nonempty 1 [ 2, 1, 4, 3, 5, 2, 5, 4 ])
--> Nonempty 1 [2,4] : Nonempty.Nonempty FloatNumeric representation of RGB.
Chroma.num (Types.RGBAColor (Color.rgb255 192 192 192))
--> 12632256 : IntReturn a configuration and a function from a float to color based on default values and a list of colors.
Return a configuration and a function from a float to color based on default values and a function given a value from 0 -> 1 produces a new color.
Return a configuration and a list of colors based on the number of equal distance buckets to create and a list of colors.
Return a configuration and a list of colors based on the number of equal distance buckets to create and and a function given a value from 0 -> 1 produces a new color.
Return a new configuration and a function from a float to color based on a new domain and list colors. If using a list of colors, they must be the same length as the domain or only the first and last values will be used.
Return a new configuration and a function from a float to color based on a new domain and a function given a value from 0 -> 1 produces a new color.
Return a new configuration and a function from a float to color using the default configuration, the given colors and the total number of colors (bins) to return.
Remove a fraction of the color gradient (0 -> 1). Applies both sides the same.
Remove a fraction of the color gradient (0 -> 1).
Return a configuration and a function from a float to color based on default values - colors White to Black, domain 0 - 1.
Return a new configuration and a function from a float to color based on the given configuration values and the given colors.
Return the data with the given colors and a new list of colors.
Return a new configuration and a function from a float to color based on an existing configuration and a new domain. If using a list of colors, they must be the same length as the domain or only the first and last values will be used.
Return a new configuration and a function from a float to color based on the given configuration values, the given colors and a predefined set of breaks/classes.
Remove a fraction of the color gradient (0 -> 1). Applies both sides the same.
Remove a fraction of the color gradient (0 -> 1).
Given a valid hex string (8, 6 or 3) or
W3CX11 Colorname and produce an RGB Color.