Created
November 4, 2015 13:08
-
-
Save casimir/b06aeb96b20901fd668a to your computer and use it in GitHub Desktop.
Display ANSI colours
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
import sys | |
terse = "-t" in sys.argv[1:] or "--terse" in sys.argv[1:] | |
for i in range(2 if terse else 10): | |
for j in range(30, 38): | |
for k in range(40, 48): | |
if terse: | |
print "\33[%d;%d;%dm%d;%d;%d\33[m " % (i, j, k, i, j, k), | |
else: | |
print ("%d;%d;%d: \33[%d;%d;%dm Hello, World! \33[m " % | |
(i, j, k, i, j, k, )) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment