-
Notifications
You must be signed in to change notification settings - Fork 1
Color related functions
The functions on this page are available by loading the color.lua extension. It is loaded by default.
Returns a string in hexadecimal format, with the first two characters being the red channel, next two being green and last two being blue.
r, g and b should be between 0 and 255.
Example:
print( level:rgb(255, 0, 0) ) -- prints 'FF0000'Returns a string in hexadecimal format, with the first two characters being the red channel, next two being green, next two being blue and last two being alpha.
r, g, b, a should be between 0 and 255.
Example:
print( level:rgb(255, 0, 0, 127) ) -- prints 'FF00007F'Returns three numbers, the red, green and blue channels obtained at h hue, s saturation and v value.
h, s and v should be between 0 and 255.
Example:
local r, g, b = level:hsvraw(32, 255, 255)
print(r, g, b) -- prints '255 192 0'Returns four numbers, the red, green, blue and alpha channels obtained at h hue, s saturation and v value.
h, s, v and a should be between 0 and 255.
Example:
local r, g, b, a = level:hsvaraw(32, 255, 255, 127)
print(r, g, b, a) -- prints '255 192 0 127'Returns a string in hexadecimal format, with the first two characters being the red channel, next two being green and last two being blue.
h, s and v should be between 0 and 255.
Example:
print( level:hsv(255, 127, 255) ) -- prints 'FF8080'Returns a string in hexadecimal format, with the first two characters being the red channel, next two being green, next two being blue and last two being alpha.
h, s, v and a should be between 0 and 255.
Example:
print( level:hsv(255, 127, 255, 255) ) -- prints 'FF8080FF'