Script engine.colors
Implements string->Color functionality, and allows the definition of colors
Defines numerous colors by default
Functions
defineColor (name, r, g, b, br, bg, bb)
Define Color
colors.simple (c)
color -> foreground table
colors.simple1 (c[, a=1])
Does: color{r,g,b} / 255
colors.unpack (c)
color -> foreground arguments
colors.hex1 (hex)
hex -> color
colors.hex1unpack (hex)
hex -> color
colors.hex1alpha (hex)
hex -> color with alpha
colors.hex1alphaunpack (hex)
hex -> color with alpha
Functions
- defineColor (name, r, g, b, br, bg, bb)
-
Define Color
Parameters:
- name string
- r int foreground red
- g int foreground green
- b int foreground blue
- br int background red
- bg int background green
- bb int background blue
- colors.simple (c)
-
color -> foreground table
Parameters:
- c table color
Returns:
-
{r, g, b}
- colors.simple1 (c[, a=1])
-
Does: color{r,g,b} / 255
Parameters:
- c table color
- a number transparency (default 1)
- colors.unpack (c)
-
color -> foreground arguments
Parameters:
- c table
Returns:
- r
- g
- b
- colors.hex1 (hex)
-
hex -> color
Parameters:
- hex string RRGGBB format hex string, 00->FF
Returns:
-
{r, g, b}
Usage:
colors.hex1("FFBBCC")
- colors.hex1unpack (hex)
-
hex -> color
Parameters:
- hex string RRGGBB format hex string, 00->FF
Returns:
- r
- g
- b
Usage:
colors.hex1unpack("FFBBCC")
- colors.hex1alpha (hex)
-
hex -> color with alpha
Parameters:
- hex string RRGGBB format hex string, 00->FF
Returns:
-
{r, g, b, a}
Usage:
colors.hex1alpha("FFBBCC88")
- colors.hex1alphaunpack (hex)
-
hex -> color with alpha
Parameters:
- hex string RRGGBB format hex string, 00->FF
Returns:
- r
- g
- b
- a
Usage:
colors.hex1alpha("FFBBCC88")