summaryrefslogtreecommitdiff
path: root/printcol.sh
diff options
context:
space:
mode:
Diffstat (limited to 'printcol.sh')
-rwxr-xr-xprintcol.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/printcol.sh b/printcol.sh
new file mode 100755
index 0000000..4d74f6b
--- /dev/null
+++ b/printcol.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# PRINT COLOURS
+#
+# DESCRIPTION
+# Output 16 or 256 terminal colour codes
+#
+# ARGS
+# 1st arg (optional): print 256 colours
+#
+
+if [[ "$1" == "256" ]]; then
+ for c in {0..255}; do
+ tput setaf $c
+ tput setaf $c | cat -v
+ echo " = $c"
+ done
+else
+ for c in {0..15}; do
+ tput setaf $c
+ tput setaf $c | cat -v
+ echo " = $c"
+ done
+fi