Color

Color is a Table that has keys r,g,b,a and 1,2,3,4.

Keys

ColorKey LetterKey Number
redr1
greeng2
blueb3
alphaa4

The alpha key is not always used depending on the function and is optional.

Ex:
local color = obj.getColorTint()
print(color.r, color.g, color.b)
print(color[1], color[2], color[3])
print(“Both are the same”)
local new_color {r = 1, g = 0.5, b = 0.25}
obj.setColorTint(new_color)


Color has duplicate keys so you can create it with shorthand.
Ex: local grey_color = {0.5, 0.5, 0.5}

If Color has mismatch between its r,g,b,a and 1,2,3,4 keys the r,g,b,a keys will take precedence if they exist in the Table.

Each color value are 0-1. So if you are used to working with 255 just divide your values by 255.
Ex: local color = {r = 55/255, g = 120/255, b = 150/255, a = 255/255}
.