chroma_solstice/color.lua

24 lines
535 B
Lua
Raw Normal View History

2015-03-11 20:11:29 -04:00
-- this module provides some helpful functions
-- for setting color!!
Color = class("Color")
2015-03-12 03:04:09 -04:00
Color.static.list = {
red = {r = 255, g = 0, b = 0, a = 255},
green = {r = 0, g = 255, b = 0, a = 255},
blue = {r = 0, g = 0, b = 255, a = 255}
}
2015-03-11 20:11:29 -04:00
function Color:initialize(inColor)
2015-03-12 03:04:09 -04:00
local c = Color.list[inColor]
self.r, self.g, self.b, self.a = c.r, c.g, c.b, c.a
2015-03-11 20:11:29 -04:00
end
function Color:set()
return self.r, self.g, self.b, self.a
2015-03-12 03:04:09 -04:00
end
function randomColor()
local colors = {"red", "green", "blue"}
return colors[math.random(1, 3)]
2015-03-11 20:11:29 -04:00
end