chameleon v2.0.1-pre3 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 section Functions
Link to this function
keyword_to_rgb_map()
Link to this function
new(r, g, b)
Link to this function
to_cmyk(rgb)
to_cmyk(Chameleon.RGB.t()) :: Chameleon.CMYK.t() | {:error, String.t()}
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}
Link to this function
to_hex(rgb)
to_hex(Chameleon.RGB.t()) :: Chameleon.Hex.t() | {:error, String.t()}
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"}
Link to this function
to_hsl(rgb)
to_hsl(Chameleon.RGB.t()) :: Chameleon.HSL.t() | {:error, String.t()}
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}
Link to this function
to_keyword(rgb)
to_keyword(Chameleon.RGB.t()) :: Chameleon.Keyword.t() | {:error, String.t()}
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."}
Link to this function
to_pantone(rgb)
to_pantone(Chameleon.RGB.t()) :: Chameleon.Pantone.t() | {:error, String.t()}
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"}