#Convert Convert colors to differnt string formats and hexadecimal strings to colors.
Converts a color to an css rgba string.
colorToCssRgba (rgba 255 0 0 0.5) -- "rgba(255, 0, 0, 0.5)"Converts a color to an css hsl string.
colorToCssHsl (hsl 1 1 0.5) -- "hsl(1, 1, 0.5)"Converts a color to an css hsla string.
colorToCssHsla (hsla 1 1 0.5 1) -- "hsla(56, 100%, 50%, 1)"Converts a color to a hexadecimal string.
colorToHex (rgb 255 0 0) -- "#ff0000"
colorToHex (rgba 255 0 0 1.0) -- "#ff0000"
colorToHex (rgba 255 0 0 0.5) -- "#ff0000"
colorToHex (rgba 255 0 0 0.0) -- "#ff0000"If you want support for colors with alpha transparency, either use colorToCssRgba or colorToHexWithAlpha.
Converts a color to a hexadecimal string.
If the color has alpha transparency different from 1, it will use the #RRGGBBAA format.
Note that the support for that is (as of March 2018) missing on IE, Edge and some mobile browsers.
It may be better to use colorToCssRgba, which has excellent support.
colorToHexWithAlpha (rgb 255 0 0) -- "#ff0000"
colorToHexWithAlpha (rgba 255 0 0 1.0) -- "#ff0000"
colorToHexWithAlpha (rgba 255 0 0 0.5) -- "#ff000080"
colorToHexWithAlpha (rgba 255 0 0 0.0) -- "#ff000000"Converts a string to Maybe of color.
hexToColor "#ff0000" -- "Ok (RGB 255 0 0)"
hexToColor "#f00" -- "Ok (RGB 255 0 0)"
hexToColor "#ff000080" -- "Ok (RGBA 255 0 0 0.5)"
hexToColor "ff0000" -- "Ok (RGB 255 0 0)"
hexToColor "f00" -- "Ok (RGB 255 0 0)"
hexToColor "ff000080" -- "Ok (RGBA 255 0 0 0.5)"
hexToColor "1234" -- "Err \"Parsing hex regex failed\""Convert color to CIELAB- color space
Convert a color in CIELAB- color space to Elm Color
Converts a color to an css rgb string.