chameleon v2.0.1-pre1 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 Types

Link to this type t()
t() :: %Chameleon.Hex{hex: String.t()}

Link to this section Functions

Link to this function keyword_to_hex_map()
Link to this function pantone_to_hex_map()

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}

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}

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."}

Converts a hex color to its pantone value.

Examples

iex> Chameleon.Hex.to_pantone(%Chameleon.Hex{hex: "D8CBEB"})
%Chameleon.Pantone{pantone: "263"}

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}