Advertisement
tecoholic

Blog Icon Generator

Nov 24th, 2018
714
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.82 KB | None | 0 0
  1. #!/usr/bin/env python
  2. """
  3. A script to generate SVG icon for the personal blog.
  4. """
  5. import svgwrite
  6.  
  7. width = 256
  8. height = 256
  9. mtop = mbottom = mright = mleft = 256/8
  10.  
  11. dwg = svgwrite.Drawing(filename="blog_icon.svg", size=(height, width))
  12.  
  13. def draw_pattern(width, color):
  14.     xpos = 256/8 + mleft
  15.     ypos = 256/8
  16.     increment = 256*2/8
  17.     vlines = dwg.add(dwg.g(id="vlines", stroke=color, stroke_width=width, stroke_linecap="round"))
  18.     hlines = dwg.add(dwg.g(id="vlines", stroke=color, stroke_width=width, stroke_linecap="round"))
  19.     while (xpos < 256*7/8):
  20.         vlines.add(dwg.line(start=(xpos,ypos), end=(xpos, 256 - mbottom)))
  21.         hlines.add(dwg.line(start=(mleft, ypos), end=(xpos+mright, ypos)))
  22.         xpos += increment
  23.         ypos += increment
  24.  
  25. draw_pattern(20, "black")
  26. draw_pattern(8, "white")
  27.  
  28. dwg.save(pretty=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement