Pote.Converters.RGB (Pote v2.2.0)

Copy Markdown View Source

Conversions to/from RGB.

Examples

iex> Pote.Converters.RGB.to_hex({255, 128, 0})
"#FF8000"

iex> Pote.Converters.RGB.to_cmyk({255, 128, 0})
{0.0, 49.8, 100.0, 0.0}

Summary

Functions

Blends dos colores RGB con un factor dado.

Clamps un valor al rango 0-255.

Calculates the Manhattan distance between two RGB colors.

Converts hexadecimal to RGB.

Converts RGB to CMYK.

Converts RGB to hexadecimal.

Converts RGB to HSL.

Converts RGB to HSV.

Converts RGB to XTerm256.

Types

cmyk()

@type cmyk() :: Pote.cmyk()

hex()

@type hex() :: Pote.hex()

hsl()

@type hsl() :: Pote.hsl()

hsv()

@type hsv() :: Pote.hsv()

rgb()

@type rgb() :: Pote.rgb()

xterm256()

@type xterm256() :: Pote.xterm256()

Functions

blend(arg1, arg2, factor)

@spec blend(rgb(), rgb(), float()) :: rgb()

Blends dos colores RGB con un factor dado.

clamp(value)

@spec clamp(integer()) :: 0..255

Clamps un valor al rango 0-255.

color_distance(arg1, arg2)

@spec color_distance(rgb(), rgb()) :: non_neg_integer()

Calculates the Manhattan distance between two RGB colors.

from_hex(hex)

@spec from_hex(hex()) :: {:ok, rgb()} | {:error, :invalid_hex_format}

Converts hexadecimal to RGB.

to_cmyk(arg)

@spec to_cmyk(rgb()) :: cmyk()

Converts RGB to CMYK.

to_hex(arg)

@spec to_hex(rgb()) :: hex()

Converts RGB to hexadecimal.

to_hsl(arg)

@spec to_hsl(rgb()) :: hsl()

Converts RGB to HSL.

to_hsv(arg)

@spec to_hsv(rgb()) :: hsv()

Converts RGB to HSV.

to_xterm256(arg)

@spec to_xterm256(rgb()) :: xterm256()

Converts RGB to XTerm256.