aboutsummaryrefslogtreecommitdiff
path: root/colorcube
diff options
context:
space:
mode:
authorjaseg <s@jaseg.de>2013-07-29 18:51:18 +0200
committerjaseg <s@jaseg.de>2013-07-29 18:51:18 +0200
commita79ab969533320582482856758394e74739b152e (patch)
tree59e320c15a282cb57318683815c8e3d529e2f087 /colorcube
parent62e62f1eace5899d0176ef0dd1b66c6ef72f7ab0 (diff)
downloadpixelterm-a79ab969533320582482856758394e74739b152e.tar.gz
pixelterm-a79ab969533320582482856758394e74739b152e.tar.bz2
pixelterm-a79ab969533320582482856758394e74739b152e.zip
Made a proper python package out of this.
Diffstat (limited to 'colorcube')
-rwxr-xr-xcolorcube23
1 files changed, 23 insertions, 0 deletions
diff --git a/colorcube b/colorcube
new file mode 100755
index 0000000..ebf36b9
--- /dev/null
+++ b/colorcube
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+import os, sys, argparse, os.path, json
+
+# Display an xterm-256color color palette on the terminal, including color ids
+
+reset_sequence = '\033[39;49m'
+
+def esc(i):
+ return '\033[48;5;'+str(i)+'m'
+
+print(''.join([str(i).ljust(4) for i in range(16)]))
+print(' '.join([esc(i) for i in range(16)])+' ' + reset_sequence)
+
+for j in range(6):
+ for k in range(6):
+ c = 16+j*6+k*6*6
+ print(''.join([str(c+i).ljust(4) for i in range(6)]))
+ print(' '.join([esc(c+i) for i in range(6)])+' ' + reset_sequence)
+
+print(''.join([str(i).ljust(4) for i in range(16+6*6*6, 16+6*6*6+24)]))
+print(' '.join([esc(i) for i in range(16+6*6*6, 16+6*6*6+24)])+' ' + reset_sequence)
+