Factorio Prototype DocsVersion 1.1.107

Color :: struct or {float, float, float} or {float, float, float, float} Example code

Table of red, green, blue, and alpha float values between 0 and 1. Alternatively, values can be from 0-255, they are interpreted as such if at least one value is > 1.

Color allows the short-hand notation of passing an array of exactly 3 or 4 numbers. The array items are r, g, b and optionally a, in that order.

The game usually expects colors to be in pre-multiplied form (color channels are pre-multiplied by alpha).

Properties

r optional :: float

red value

red value

g optional :: float

green value

green value

b optional :: float

blue value

blue value

a optional :: float

alpha value (opacity)

alpha value (opacity)

Properties

r :: float optional

Default: 0

red value

g :: float optional

Default: 0

green value

b :: float optional

Default: 0

blue value

a :: float optional

Default: 1

alpha value (opacity)

Example

color = {r=1, g=0, b=0, a=1} -- red, full opacity
color = {r=1} -- the same red, omitting default values
color = {1, 0, 0, 1} -- also the same red
color = {0, 0, 1} -- blue
color = {r=0, g=0.5, b=0, a=0.5} -- half transparency green
color = {} -- full opacity black

Type used in

Prototypes

Types