View Source Colorex.RGB (Colorex v1.0.0)

Struct that represents a color in the RGB colorspace

Summary

Types

t()

A representation of a color in red, green, blue and alpha.

Functions

Returns R, G, and B values as percents rather than 0-255

Types

t()

@type t() :: %Colorex.RGB{
  alpha: :float,
  blue: :pos_integer,
  green: :pos_integer,
  red: :pos_integer
}

A representation of a color in red, green, blue and alpha.

Functions

rgb_percents(map)

Returns R, G, and B values as percents rather than 0-255

Example:

iex> Colorex.parse!({51, 102, 153}) |> Colorex.rgb() |> Colorex.RGB.rgb_percents()
{0.2, 0.4, 0.6}