Module color

ERGB library main module.

Description

ERGB library main module

It contains the entry points of the library color conversion and manipulation API.

For general documentation, please, consult the overview page.

Data Types

color()

abstract datatype: color()

It represents a color in the ERGB library. Its internal structure is private.

rgb()

rgb() = {byte(), byte(), byte()}

It represents a color in the rgb color scheme. It is essentially a tuple where:

first element of tuple
Red component: 0..255
second element of tuple
Green component: 0..255
third element of tuple
Blue component: 0..255

Function Index

darken/2 Darkens a color() type instance adding an amount of darkness more in the color.
darken_in_percent/2 Darkens a color() type instance increasing its darkness by taking away an amount of percentage lightness.
desaturate/2 Desaturates a color() type instance adding an amount of unsaturation more in the color.
desaturate_in_percent/2 Desaturates a color() type instance increasing its desaturation by taking away an amount of percentage saturation.
from_fractions/3 Constructs a color instance from hue, saturation, lightness fractions.
from_rgb/1 Constructs a color instance from a red, green, blue tuple.
from_rgb_hex/1 Constructs a color instance from an integer or from a rrggbb formatted string.
invert/1 Invertes a color() type instance in rgb.
lighten/2 Lightens a color() type instance adding an amount of lightness more in the color.
lighten_in_percent/2 Lightens a color() type instance increasing its lightness by taking away an amount of percentage darkness.
mix/2 Mixes two color() type instances equally (coefficient=0.5).
mix/3 Mixes two color() type instances with a percentage mixing coefficient.
new/3 Constructs a color instance from hue, saturation, lightness.
rgb_to_hsl/1 Converts a color given in RGB representation to HSL representation.
saturate/2 Saturates a color() type instance adding an amount of saturation more in the color.
saturate_in_percent/2 Saturates a color() type instance increasing its saturation by taking away an amount of percentage unsaturation.
set_hue/2 Sets hue for a color() type instance.
set_lightness/2 Sets lightness for a color() type instance.
set_saturation/2 Sets saturation for a color() type instance.
to_hsl/1 Converts a color() type instance to a hue, saturation, lightness tuple.
to_rgb/1 Converts a color() type instance to a red, green, blue tuple.
to_rgb_hex/1 Converts a color() type instance to #rrggbb formatted string.

Function Details

darken/2

darken(Amount, Color) -> Color2

Amount: a percentage amount between 0..100.0
Color: the input color() type instance

returns: the resulting darkened color() type instance

Darkens a color() type instance adding an amount of darkness more in the color.

darken_in_percent/2

darken_in_percent(Amount, Color) -> Color2

Amount: a percentage amount between 0..100.0
Color: the input color() type instance

returns: the resulting darkened color() type instance

Darkens a color() type instance increasing its darkness by taking away an amount of percentage lightness.

desaturate/2

desaturate(Amount, Color) -> Color2

Amount: a percentage amount between 0..100.0
Color: the input color() type instance

returns: the resulting desaturated color() type instance

Desaturates a color() type instance adding an amount of unsaturation more in the color.

desaturate_in_percent/2

desaturate_in_percent(Amount, Color) -> Color2

Amount: a percentage amount between 0..100.0
Color: the input color() type instance

returns: the resulting desaturated color() type instance

Desaturates a color() type instance increasing its desaturation by taking away an amount of percentage saturation.

from_fractions/3

from_fractions(H, S, L) -> color()

H: the input hue: 0..1.0
S: the input saturation: 0..1.0
L: the input lightness: 0..1.0

returns: the color() type instance

Constructs a color instance from hue, saturation, lightness fractions.

from_rgb/1

from_rgb(RGB) -> color()

RGB: the rgb() input color

returns: the constucted color() type instance

Constructs a color instance from a red, green, blue tuple.

from_rgb_hex/1

from_rgb_hex(StrOrInteger) -> color()

StrOrInteger:


returns: the constucted color() type instance

Constructs a color instance from an integer or from a rrggbb formatted string.

invert/1

invert(Color) -> Color2

Color: the input color() type instance

returns: the resulting inverted color() type instance

Invertes a color() type instance in rgb

lighten/2

lighten(Amount, Color) -> Color2

Amount: a percentage amount between 0..100.0
Color: the input color() type instance

returns: the resulting lightened color() type instance

Lightens a color() type instance adding an amount of lightness more in the color.

lighten_in_percent/2

lighten_in_percent(Amount, Color) -> Color2

Amount: a percentage amount between 0..100.0
Color: the input color() type instance

returns: the resulting lightened color() type instance

Lightens a color() type instance increasing its lightness by taking away an amount of percentage darkness.

mix/2

mix(OtherColor, Color) -> MixedColor

OtherColor: the other input color() type instance to be mixed in
Color: the input color() type instance to which the other color be mixed

returns: the resulting mixed color() type instance

Mixes two color() type instances equally (coefficient=0.5)

mix/3

mix(OtherColor, Percentage, Color) -> MixedColor

OtherColor: the other input color() type instance to be mixed in
Percentage: a percentage amount between 0..100.0 defining the other color mixing-in coefficient
Color: the input color() type instance to which the other color be mixed

returns: the resulting mixed color() type instance

Mixes two color() type instances with a percentage mixing coefficient

new/3

new(H, S, L) -> color()

H: the input hue: 0..360
S: the input saturation: 0..1.0
L: the input lightness: 0..1.0

returns: the constucted color() type instance

Constructs a color instance from hue, saturation, lightness.

rgb_to_hsl/1

rgb_to_hsl(RGB) -> {H, S, L}

RGB: an rgb() representing the color to be converted to HSL

returns: the resulted hue, saturation, lightness tuple

Converts a color given in RGB representation to HSL representation

saturate/2

saturate(Amount, Color) -> Color2

Amount: a percentage amount between 0..100.0
Color: the input color() type instance

returns: the resulting saturated color() type instance

Saturates a color() type instance adding an amount of saturation more in the color.

saturate_in_percent/2

saturate_in_percent(Amount, Color) -> Color2

Amount: a percentage amount between 0..100.0
Color: the input color() type instance

returns: the resulting saturated color() type instance

Saturates a color() type instance increasing its saturation by taking away an amount of percentage unsaturation.

set_hue/2

set_hue(Hue, Color) -> color()

Hue: the hue value between 0..360.0 to be set
Color: the input color() type instance

returns: the resulting color() type instance

Sets hue for a color() type instance

set_lightness/2

set_lightness(Lightness, Color) -> color()

Lightness: the lightness value between 0..1.0 to be set
Color: the input color() type instance

returns: the resulting color() type instance

Sets lightness for a color() type instance

set_saturation/2

set_saturation(Saturation, Color) -> color()

Saturation: the saturation value between 0..1.0 to be set
Color: the input color() type instance

returns: the resulting color() type instance

Sets saturation for a color() type instance

to_hsl/1

to_hsl(Color) -> {H, S, L}

Color: the input color() type instance

returns: the resulting hue, saturation, lightness tuple

Converts a color() type instance to a hue, saturation, lightness tuple.

to_rgb/1

to_rgb(Color) -> RGB

Color: the input color() type instance

returns: the resulting rgb() type value

Converts a color() type instance to a red, green, blue tuple.

to_rgb_hex/1

to_rgb_hex(Color) -> HexString

Color: the input color() type instance

returns: the resulting string

Converts a color() type instance to #rrggbb formatted string.

In the formatted string:


Generated by EDoc, Dec 3 2019, 00:00:31.