Skip to content

Instantly share code, notes, and snippets.

@tehmaze
Created January 29, 2011 16:01
Show Gist options
  • Save tehmaze/801945 to your computer and use it in GitHub Desktop.
Save tehmaze/801945 to your computer and use it in GitHub Desktop.
bitlair.nl logo
#! /usr/bin/python
#
# compile logo:
#
# user@bitlair ~$ python bitlair.py > bitlair.svg
# user@bitlair ~$ convert bitlair.svg bitlair.png
# user@bitlair ~$ aplay tada.wav
#
LOGO = '''
#
# # #
### # ## # # # ##
# # # # # # # #
### # ## ## ### # #
'''
SIZE = 15
COLOR = ('#FD9C1E', '#FD5A1E')
LINES = LOGO.splitlines()[1:-1]
WIDTH = max(map(lambda line: len(line), LINES))
print '''<svg width='%d' height='%d' style="fill:black" >
<g fill='#FF0000' stroke='%s' stroke-width='1'>
<rect x='-1' y='-1' width='%d' height='%d' style="fill:black"/>
''' % (WIDTH * SIZE, len(LINES) * SIZE, COLOR[0],
WIDTH * SIZE + 1, len(LINES) * SIZE + 1)
for y, line in enumerate(LINES):
for x, char in enumerate(line):
if char <> ' ':
print '<rect x="%d" y="%d" width="%d" height="%d" style="fill:%s" />' % \
(x * SIZE, y * SIZE, SIZE -3 , SIZE -3, COLOR[1])
print '''</g>
</svg>
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment