Module Color
Description
Module Status: Work in progress.
Usage:
local Color = require('__eradicators-library__/erlib/factorio/Color')()
Concepts
ColorSpecification | A color specification. |
NormalizedColor | A lua table representing an RGBA color. |
Functions
Color(color_spec) | Creates a color table. |
premultiply_alpha(rgba_color[, alpha]) | Multiplies all channels of a color table with alpha. |
Concepts
- ColorSpecification
-
A color specification.
RGB(A) table:
{r=1, g=1, b=1, a=1}
or{1, 1, 1, 1}
Hex-RGB(A) string:
"#F5FFFA"
,"#F5FFFA77"
Html color name string:
"MintCream"
,"MistyRose"
, ...Factorio logistic mode name string:
"passive-provider"
,"storage"
,...Shade of gray (0-100) string:
"gray42%"
- NormalizedColor
-
A lua table representing an RGBA color.
All values are UnitIntervals.
{r=1, g=1, b=1, a=1}
Functions
- Color(color_spec)
-
Creates a color table.
Parameters:
- color_spec ColorSpecification
Returns:
- premultiply_alpha(rgba_color[, alpha])
-
Multiplies all channels of a color table with alpha.
Factorio expects color in this format most of the time.
Parameters:
- rgba_color NormalizedColor
- alpha
UnitInterval
Will be used instead of
color.a
if given. (optional)
Returns:
-
NormalizedColor
A new color table.