chameleon v2.0.1-pre1 Chameleon.RGB

Link to this section Summary

Functions

Converts an rgb color to its cmyk value

Converts an rgb color to its hex value

Converts an rgb color to its hsl value

Converts an rgb color to its keyword value

Converts an rgb color to its pantone value

Link to this section Types

Link to this type t()
t() :: %Chameleon.RGB{b: integer(), g: integer(), r: integer()}

Link to this section Functions

Link to this function keyword_to_rgb_map()

Converts an rgb color to its cmyk value.

Examples

iex> Chameleon.RGB.to_cmyk(%Chameleon.RGB{r: 255, g: 0, b: 0})
%Chameleon.CMYK{c: 0, m: 100, y: 100, k: 0}

Converts an rgb color to its hex value.

Examples

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

Converts an rgb color to its hsl value.

Examples

iex> Chameleon.RGB.to_hsl(%Chameleon.RGB{r: 255, g: 0, b: 0})
%Chameleon.HSL{h: 0, s: 100, l: 50}

Converts an rgb color to its keyword value.

Examples

iex> Chameleon.RGB.to_keyword(%Chameleon.RGB{r: 255, g: 0, b: 0})
%Chameleon.Keyword{keyword: "red"}

iex> Chameleon.RGB.to_keyword(%Chameleon.RGB{r: 255, g: 75, b: 42})
{:error, "No keyword match could be found for that rgb value."}

Converts an rgb color to its pantone value.

Examples

iex> Chameleon.RGB.to_pantone(%Chameleon.RGB{r: 0, g: 0, b: 0})
%Chameleon.Pantone{pantone: "30"}