14 lines
490 B
Lua
14 lines
490 B
Lua
function infatuated.parseColor(r, g, b, a)
|
|
if type(r) == "table" then
|
|
return infatuated.parseColor(r[1], r[2], r[3], r[4])
|
|
elseif type(r) == "number" then
|
|
a = a or 1
|
|
assert(type(g) == "number", "bad argument #2 to parseColor")
|
|
assert(type(b) == "number", "bad argument #3 to parseColor")
|
|
assert(type(a) == "number", "bad argument #4 to parseColor")
|
|
return {r, g, b, a}, string.format("rgba(%f, %f, %f, %f)", r, g, b, a)
|
|
else
|
|
error("bad argument #1 to parseColor")
|
|
end
|
|
end
|