color
Constructors
local col = color(255, 255, 255, 200) -- r, g, b, a
local col = color() -- equals to color(255, 255, 255, 255)
local col = color(230) -- equals to color(230, 230, 230, 255)
local col = color(230, 120) -- equals to color(230, 230, 230, 120)
local col = color(120, 160, 145) -- equals to color(120, 160, 145, 255)
local col = color():as_int32(0xFFFFFFFF) -- init from 32bit hex value
local col = color():as_fraction(0.13, 0.523, 0.87, 0.5) -- equals to color(0.13 * 255, 0.523 * 255, 0.87 * 255, 0.5 * 255)as_int32
col:as_int32(col: number) color
Overwrites color from 32bit hex value, returns self.
as_fraction
col:as_fraction(r: number, g: number, b: number[, a: number]) color
r
number
Red channel fraction [0, 1].
g
number
Green channel fraction [0, 1].
b
number
Blue channel fraction [0, 1].
a
number
Optional. Alpha channel fraction [0, 1].
to_int32
col:to_int32() number
Returns int32 representation of color.
to_fraction
col:to_fraction() number[]
Return table of 4 numbers representing fractions [0, 1] of color channels.
alpha_modulate
col:alpha_modulate(alpha: number) color
Overwrites alpha value for this color, returns self.
alpha_modulatef
col:alpha_modulatef(weight: number) color
Multiplies current alpha by weight, returns self.
lerp
col:lerp(other: color, weight: number) color
Returns linearly interpolated color.
clone
col:clone() color
Copies current color
Last updated