eskimoblood/elm-color-extra/3.0.4

NOTE: this package is not compatible with Elm 0.19.1

Color.Convert

#Convert Convert colors to differnt string formats and hexadecimal strings to colors.

colorToCssRgb : Color -> String

Converts a color to an css rgb string.

colorToCssRgb (rgb 255 0 0 ) -- "rgb(255, 0, 0)"
colorToCssRgba : Color -> String

Converts a color to an css rgba string.

colorToCssRgb (rgba 255 0 0 0.5) -- "rgb(255, 0, 0, 0.5)"
colorToCssHsl : Color -> String

Converts a color to an css hsl string.

colorToCssRgb (hsl 1 1 0.5) -- "hsl(1, 1, 0.5)"
colorToCssHsla : Color -> String

Converts a color to an css hsla string.

colorToCssRgb (hsla 1 1 0.5 1) -- "hsla(56, 100%, 50%, 1)"
colorToHex : Color -> String

Converts a color to a hexadecimal string.

hexToColor (rgb 255 0 0) -- "#ff0000"
hexToColor : String -> Maybe Color

Converts a string to Maybe of color.

hexToColor "#ff0000" -- "Just RGB 255 0 0"
hexToColor "ff0000" -- "Just RGB 255 0 0"
hexToColor "1234" -- "Nothing"
Color
-> { l : Float
, a : Float
, b : Float
}

Convert color to CIELAB- color space

{ l : Float
, a : Float
, b : Float
}
-> Color

Convert a color in CIELAB- color space to Elm Color