chameleon v2.0.1-pre3 Chameleon.Hex
Link to this section Summary
Functions
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 section Functions
Link to this function
keyword_to_hex_map()
Link to this function
new(hex)
Link to this function
pantone_to_hex_map()
Link to this function
to_keyword(hex)
to_keyword(Chameleon.Hex.t()) :: Chameleon.Keyword.t() | {:error, String.t()}
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(Chameleon.Hex.t()) :: Chameleon.Pantone.t() | {:error, String.t()}
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(Chameleon.Hex.t()) :: Chameleon.RGB.t() | {:error, String.t()}
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}