Skip to content

color

A RGBA color structure

Properties

Type Name Description
number r Red
number g Green
number b Blue
number a Alpha

Methods

new(r, g, b, a): color

Type Name Description Default
number r Red 0
number g Green 0
number b Blue 0
number a Alpha 255

Constructor

1
2
3
local my_color = color.new() -- r = 0, g = 0, b = 0, a = 0
local my_color_2 = color.new(239, 9, 95) -- r, g, b = 239, 9, 95; a = 255
local my_color_3 = color.new(123, 123, 123, 123) -- r, g, b, a = 123

from_hsv(h, s, v)

Type Name Description Default
number h Hue none
number s Saturation none
number v Brightness none

Converts h, s, v to r, g, b and updates current color

1
my_color:from_hsv(200, 1.0, 1.0)