Tint v0.1.0 Tint.RGB View Source

A color in the RGB (red, green, blue) colorspace.

Link to this section Summary

Functions

Builds a new RGB color from the given hex code.

Builds a new RGB color from the given hex code. Raises when the given hex code is invalid.

Builds a new RGB color from red, green and blue color ratios.

Converts a tuple containing hue, saturation and value into a Tint.RGB struct.

Builds a new RGB color from red, green and blue color values.

Converts a RGB color to a hex code.

Converts RGB color into a tuple containing the red, green and blue parts.

Link to this section Types

Link to this type

t() View Source
t() :: %Tint.RGB{
  blue: non_neg_integer(),
  green: non_neg_integer(),
  red: non_neg_integer()
}

Link to this section Functions

Link to this function

from_hex(code) View Source
from_hex(String.t()) :: {:ok, t()} | :error

Builds a new RGB color from the given hex code.

Link to this function

from_hex!(code) View Source
from_hex!(String.t()) :: t() | no_return()

Builds a new RGB color from the given hex code. Raises when the given hex code is invalid.

Link to this function

from_ratios(red_ratio, green_ratio, blue_ratio) View Source
from_ratios(
  Decimal.t() | number(),
  Decimal.t() | number(),
  Decimal.t() | number()
) :: t()

Builds a new RGB color from red, green and blue color ratios.

Link to this function

from_tuple(arg) View Source
from_tuple(
  {Decimal.t() | number(), Decimal.t() | number(), Decimal.t() | number()}
) :: t()

Converts a tuple containing hue, saturation and value into a Tint.RGB struct.

Link to this function

new(red, green, blue) View Source
new(Decimal.t() | number(), Decimal.t() | number(), Decimal.t() | number()) ::
  t()

Builds a new RGB color from red, green and blue color values.

Link to this function

to_hex(color) View Source
to_hex(t()) :: String.t()

Converts a RGB color to a hex code.

Converts RGB color into a tuple containing the red, green and blue parts.