Skip to content

Instantly share code, notes, and snippets.

@schmichael
Last active August 29, 2015 13:59
Show Gist options
  • Save schmichael/10490771 to your computer and use it in GitHub Desktop.
Save schmichael/10490771 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
hearts = "\u2661\u2665"
colors = list(map(str, range(30, 38)))
prefix = "\x1B["
mid = "m"
def cycle(x):
while 1:
yield from x
try:
for heart, color in zip(cycle(hearts), cycle(colors)):
print(prefix + color + mid + heart, end='')
except KeyboardInterrupt:
print(prefix + mid)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment