chameleon v2.0.0 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 keyword_to_hex_map()
Link to this function pantone_to_hex_map()
Link to this function to_cmyk(hex)
to_cmyk(struct()) :: struct()

Converts a hex color to its cmyk value.

Examples

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

Converts a hex color to its hsl value.

Examples

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

Converts a hex color to its keyword value.

Examples

iex> Chameleon.Hex.to_keyword(%Chameleon.Hex{hex: "FF00FF"})
%Chameleon.Keyword{keyword: "fuchsia"}

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

Converts a hex color to its pantone value.

Examples

iex> Chameleon.Hex.to_pantone(%Chameleon.Hex{hex: "D8CBEB"})
%Chameleon.Pantone{pantone: "263"}
Link to this function to_rgb(hex)
to_rgb(struct()) :: struct()

Converts a hex color to its rgb value.

Examples

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

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