Skip to content

Instantly share code, notes, and snippets.

@hyrodium
Created February 27, 2022 07:25
Show Gist options
  • Save hyrodium/ec1cc636c4e63722d2df8044d462eba7 to your computer and use it in GitHub Desktop.
Save hyrodium/ec1cc636c4e63722d2df8044d462eba7 to your computer and use it in GitHub Desktop.
using Luxor, Colors
R = 100
@svg begin
Drawing(400,400, "logo_a.svg")
p_1 = Point(0, 0)
p_i = Point(2R/√3, 0)
p_j = Point(-R/√3, -R)
p_k = Point(-R/√3, R)
p__i = Point(-R/√3,0)
p__j = Point(R/2√3, R/2)
p__k = Point(R/2√3, -R/2)
tt = 0.25
setline(12)
setlinecap("round")
for i in 1:3
origin()
a = -2π/3*(i-1)
rotate(a)
sethue(Colors.JULIA_LOGO_COLORS[(:red,:green,:blue)[i]])
arc(p__i, R, 5π/2+tt, 3π/2-tt, :stroke)
arc(p__i, R, π/6+tt, 3π/6-tt, :stroke)
arc(p__i, R, -π/6+tt, 0-tt*2/3, :stroke)
arc(p__i, R, 0+tt*2/3, π/6-tt, :stroke)
arc(p__i, R, 3π/2+tt, -π/6-tt, :stroke)
line(-1.6*p_i, p__i-Point(R*(1+tt*2/3),0), :stroke)
line(p__i-Point(R*(1-tt*2/3),0),p__i-Point(25,0), :stroke)
line(p_1-Point(25,0), p__i+Point(25,0), :stroke)
line(p_1+Point(25,0), p_i-Point(25,0), :stroke)
line(p_i+Point(25,0), 1.6p_i, :stroke)
poly(ngon(Point(R*0.65, 0), 18, 3, vertices=true), :fill, close=true)
poly(ngon(Point(-R*1.1, 0), 18, 3, vertices=true), :fill, close=true)
p = [p__i, p__j, p__k][i]
origin(Point(200,200)+p+R*Point(cos(-3π/4+a),sin(-3π/4+a)))
rotate(3π/4)
poly(ngon(Point(0, 0), 18, 3, vertices=true), :fill, close=true)
origin()
origin(Point(200,200)+p+R*Point(cos(π/3+a),sin(π/3+a)))
rotate(pi/2)
poly(ngon(Point(0, 0), 18, 3, vertices=true), :fill, close=true)
origin()
end
sethue(Colors.JULIA_LOGO_COLORS[:purple])
circle(p_1, 15, :fill)
circle(p__k, 15, :fill)
circle(p__j, 15, :fill)
circle(p__i, 15, :fill)
circle(p_j, 15, :fill)
circle(p_k, 15, :fill)
circle(p_i, 15, :fill)
end
@svg begin
Drawing(400,400, "logo_b.svg")
background(RGBA(1,1,0,0))
p_1 = Point(0, 0)
p_i = Point(2R/√3, 0)
p_j = Point(-R/√3, -R)
p_k = Point(-R/√3, R)
p__i = Point(-R/√3,0)
p__j = Point(R/2√3, R/2)
p__k = Point(R/2√3, -R/2)
tt = 0.25
setline(12)
setlinecap("round")
for i in 1:3
origin()
a = -2π/3*(i-1)
rotate(a)
sethue(Colors.JULIA_LOGO_COLORS[(:red,:green,:blue)[i]])
arc(p__i, R, 5π/2+tt, 3π/2-tt, :stroke)
arc(p__i, R, π/6+tt, 3π/6-tt, :stroke)
arc(p__i, R, -π/6+tt, π/6-tt, :stroke)
arc(p__i, R, 3π/2+tt, -π/6-tt, :stroke)
p = [p__i, p__j, p__k][i]
origin(Point(200,200)+p+R*Point(cos(-3π/4+a),sin(-3π/4+a)))
rotate(3π/4)
poly(ngon(Point(0, 0), 18, 3, vertices=true), :fill, close=true)
origin()
origin(Point(200,200)+p+R*Point(cos(π/3+a),sin(π/3+a)))
rotate(pi/2)
poly(ngon(Point(0, 0), 18, 3, vertices=true), :fill, close=true)
origin()
end
sethue(Colors.JULIA_LOGO_COLORS[:purple])
circle(p__k, 15, :fill)
circle(p__j, 15, :fill)
circle(p__i, 15, :fill)
circle(p_j, 15, :fill)
circle(p_k, 15, :fill)
circle(p_i, 15, :fill)
end
@svg begin
# This needs π/6 rotation after generating svg.
Drawing(400,400,"logo_c.svg")
background(RGBA(1,1,0,0))
p_1 = Point(0, 0)
p_i = Point(2R/√3, 0)
p_j = Point(-R/√3, -R)
p_k = Point(-R/√3, R)
p__i = Point(-R/√3,0)
p__j = Point(R/2√3, R/2)
p__k = Point(R/2√3, -R/2)
tt = 0.25
setline(12)
setlinecap("round")
for i in 1:3
origin()
a = -2π/3*(i-1)
rotate(a)
sethue(Colors.JULIA_LOGO_COLORS[(:red,:purple,:green)[i]])
arc(p__i, R, 5π/2+tt, 3π/2-tt, :stroke)
arc(p__i, R, π/6+tt, 3π/6-tt, :stroke)
arc(p__i, R, -π/6+tt, π/6-tt, :stroke)
arc(p__i, R, 3π/2+tt, -π/6-tt, :stroke)
p = [p__i, p__j, p__k][i]
origin(Point(200,200)+p+R*Point(cos(-3π/4+a),sin(-3π/4+a)))
rotate(3π/4)
poly(ngon(Point(0, 0), 18, 3, vertices=true), :fill, close=true)
origin()
origin(Point(200,200)+p+R*Point(cos(π/3+a),sin(π/3+a)))
rotate(pi/2)
poly(ngon(Point(0, 0), 18, 3, vertices=true), :fill, close=true)
origin()
end
sethue(Colors.JULIA_LOGO_COLORS[:blue])
circle(p__k, 15, :fill)
circle(p__j, 15, :fill)
circle(p__i, 15, :fill)
circle(p_j, 15, :fill)
circle(p_k, 15, :fill)
circle(p_i, 15, :fill)
end
run(`convert -density 256x256 -background transparent logo_a.svg -define icon:auto-resize -colors 256 favicon_a.ico`)
run(`convert -density 256x256 -background transparent logo_b.svg -define icon:auto-resize -colors 256 favicon_b.ico`)
run(`convert -density 256x256 -background transparent logo_c.svg -define icon:auto-resize -colors 256 favicon_c.ico`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment