mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-29 18:53:44 +01:00
Add colorspec.from_number_rgb
This commit is contained in:
parent
6f0dbaaeb3
commit
3acf09eed6
@ -217,6 +217,16 @@ function colorspec.from_number(number)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function colorspec.from_number_rgb(number)
|
||||||
|
local floor = math.floor
|
||||||
|
return colorspec.from_table{
|
||||||
|
a = 0xFF,
|
||||||
|
b = number % 0x100,
|
||||||
|
g = floor(number / 0x100) % 0x100,
|
||||||
|
r = floor(number / 0x10000)
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
function colorspec.from_any(value)
|
function colorspec.from_any(value)
|
||||||
local type = type(value)
|
local type = type(value)
|
||||||
if type == "table" then
|
if type == "table" then
|
||||||
|
Loading…
Reference in New Issue
Block a user