207
208
209
210
211
212
213
214
215
216
217
218
219
220
|
}
if g == nil then
if type(r) == 'string' then
assert(false) -- TODO parse color string
elseif type(r) == 'table' then
if r.hue then
return from_hsl(r, r.alpha or g)
else
new.red = r[1]
new.green = r[2]
new.blue = r[3]
new.alpha = r[4]
end
else assert(false) end
|
|
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
|
}
if g == nil then
if type(r) == 'string' then
assert(false) -- TODO parse color string
elseif type(r) == 'table' then
if r.hue then
return from_hsl(r, r.alpha or g)
elseif r.r and r.g and r.b then
new.red = r.r
new.green = r.g
new.blue = r.b
new.alpha = r.a
else
new.red = r[1]
new.green = r[2]
new.blue = r[3]
new.alpha = r[4]
end
else assert(false) end
|