Archive
Posts Tagged ‘rainbow’
Unicode box-drawing characters
March 20, 2014
Leave a comment
I wanted to make a logo for my project PrimCom. Since it runs in the command line, I wanted to draw the logo with characters.
You can find a list of box-drawing characters here. I designed the logo on a paper, translated the box characters to normal characters (this way it was easier to type them in), then translated the characters back with a script.
Python source:
#!/usr/bin/env python
# encoding: utf-8
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import sys
chars = {
'a': '┌',
'b': '┐',
'c': '┘',
'd': '└',
'e': '─',
'f': '│',
'g': '┴',
'h': '├',
'i': '┬',
'j': '┤',
'k': '╷',
'l': '┼',
}
logo = """
aeeb aeeb
fabf faec
fdcheiieejf aeeieeb
faejaljkkff fabfkkf
ff fffffffdejdcffff
dc dcdggggeegeegggc
"""
def main():
for c in logo:
if c in chars:
sys.stdout.write(chars[c])
else:
sys.stdout.write(c)
if __name__ == "__main__":
main()
Output:
┌─────┐ ┌─────┐ │ ┌─┐ │ │ ┌───┘ │ └─┘ ├───┬─┬─────┤ │ ┌─────┬─────┐ │ ┌───┤ ┌─┼─┤ ╷ ╷ │ │ │ ┌─┐ │ ╷ ╷ │ │ │ │ │ │ │ │ │ │ └───┤ └─┘ │ │ │ │ └─┘ └─┘ └─┴─┴─┴─┴─────┴─────┴─┴─┴─┘
Update (20140322)
If you want rainbow colors, check out the colout project.
Categories: python
box-drawing, logo, rainbow, unicode
