-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathColor.lua
More file actions
26 lines (13 loc) · 564 Bytes
/
Color.lua
File metadata and controls
26 lines (13 loc) · 564 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
local astro = Astro.Type local isNumber = astro.isNumber local isTable = astro.isTable
astro = Astro.Table
local function isColor(a)
if not isTable(a) or #a ~= 4 then return false end
-- It's a color if it doesn't find any non numbers.
local function isValid( k, v ) return not isNumber(v) end
return not astro.contains( a, isValid )
end
local function random(s, v)
local h = math.random(0, 360) s = s or 1 v = v or 1
return HSV( h, s, v )
end
tapLua.Color = { isColor = isColor, random = random }