chameleon v1.0.3 Chameleon.Hex

Link to this section Summary

Functions

Converts a hex color to its cmyk value

Converts a hex color to its hsl value

Converts a hex color to its keyword value

Converts a hex color to its pantone value

Converts a hex color to its rgb value

Link to this section Functions

Link to this function to_cmyk(hex)
to_cmyk(charlist()) :: [integer()]

Converts a hex color to its cmyk value.

Examples

iex> Chameleon.Hex.to_cmyk("FF0000")
%{c: 0, m: 100, y: 100, k: 0}
Link to this function to_hsl(hex)
to_hsl(charlist()) :: [integer()]

Converts a hex color to its hsl value.

Examples

iex> Chameleon.Hex.to_hsl("FF0000")
%{h: 0, s: 100, l: 50}
Link to this function to_keyword(hex)
to_keyword(charlist()) :: charlist()

Converts a hex color to its keyword value.

Examples

iex> Chameleon.Hex.to_keyword("FF00FF")
"fuchsia"

iex> Chameleon.Hex.to_keyword("6789FE")
{:error, "No keyword match could be found for that hex value."}
Link to this function to_pantone(hex)
to_pantone(charlist()) :: charlist()

Converts a hex color to its pantone value.

Examples

iex> Chameleon.Hex.to_pantone("D8CBEB")
"263"
Link to this function to_rgb(hex)
to_rgb(charlist()) :: [integer()]

Converts a hex color to its rgb value.

Examples

iex> Chameleon.Hex.to_rgb("FF0000")
%{r: 255, g: 0, b: 0}

iex> Chameleon.Hex.to_rgb("F00")
%{r: 255, g: 0, b: 0}