-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua
28 lines (21 loc) · 834 Bytes
/
main.lua
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
27
local GeoPattern = require "geopattern.lib"
local pattern1 = GeoPattern:new("GitHub") -- without options
local svg1 = pattern1:toSvg()
local pattern2 = GeoPattern:new("GitHub", { generator = "concentricCircles" })
local svg2 = pattern2:toSvg()
local pattern3 = GeoPattern:new("GitHub", { color = "#00ffff" })
local base64 = pattern3:toBase64()
local options = {
generator = "concentricCircles",
color = "#00ffff",
baseColor = "#af39b3"
}
local pattern4 = GeoPattern:new("GitHub", options) -- with all available options
local svg4 = pattern4:toSvg()
for i = 1, #GeoPattern.patterns do
local pattern = GeoPattern:new("GitHub", { generator = GeoPattern.patterns[i] })
pattern:toBase64()
local file = io.open(GeoPattern.patterns[i] .. ".svg", "w")
file:write(pattern:toSvg())
file:close()
end