dev

This is the documentation page for Module:Docbunto/testcases/Classmod

Color item class, used for color processing. The class provides color prop getter-setters, procedures for color computation, compositing methods and serialisation into CSS color formats.

Documentation

Package items

Color.tup (table)
Color tuple.
Color.typ (member • string)
Color space type.
Color.alp (member • number)
Color alpha channel value.
Color:new(typ, tup, alp) (function • constructor)
Color instance constructor.
Parameters:
typ Color space type ('hsl' or 'rgb'). (string)
tup Color tuple in HSL or RGB (table)
alp Alpha value range (0 - 1). (number)
Errors:
'no color data provided' (line 304)
'invalid color type "$1" specified' (line 309)
Returns: Color instance. (Color)
Color:string() (function)
Color string default output.
Returns: Hexadecimal 6-digit or HSLA color string. (string)
Usage:
colors.parse('hsl(214, 15%, 30%)'):string() == '#404a57'
colors.parse('#404a5780'):string() == 'hsl(214, 15%, 30%, 0.5)'
Color:hex() (function)
Color hexadecimal string output.
Returns: Hexadecimal color string. (string)
Usage: colors.parse('hsl(214, 15%, 30%)'):hex() == '#404a57'
Color:rgb() (function)
RGBA functional color string output.
Returns: RGBA color string. (string)
Usage: colors.parse('hsl(214, 15%, 30%)'):rgb() == 'rgb(64, 74, 87)'
See also: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#rgb()_and_rgba()
Color:hsl() (function)
HSL functional color string output.
Returns: HSLA color string. (string)
Usage: colors.parse('rgb(64, 74, 87)'):hsl() == 'hsl(214, 15%, 30%)'
See also: https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#hsl()_and_hsla()