aboutsummaryrefslogtreecommitdiffstats
path: root/unix/term_color_2.sh
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2017-01-19 19:19:24 +0800
committerAaron LI <aaronly.me@outlook.com>2017-01-19 19:19:24 +0800
commita1815079ad4ff8076eb33bbd3f6b50e5c1a66763 (patch)
tree6bb032fb65e39e307288163f3adc64c0b2ffbcf6 /unix/term_color_2.sh
parent582e8827ad9fe6c7843d7f4ad86337b68270996f (diff)
downloadatoolbox-a1815079ad4ff8076eb33bbd3f6b50e5c1a66763.tar.bz2
Add various scripts
Diffstat (limited to 'unix/term_color_2.sh')
-rwxr-xr-xunix/term_color_2.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/unix/term_color_2.sh b/unix/term_color_2.sh
new file mode 100755
index 0000000..4dc2ef2
--- /dev/null
+++ b/unix/term_color_2.sh
@@ -0,0 +1,32 @@
+#!/usr/bin/env bash
+# Original: http://frexx.de/xterm-256-notes/
+# http://frexx.de/xterm-256-notes/data/colortable16.sh
+# Modified by Aaron Griffin
+# and further by Kazuo Teramoto
+FGNAMES=(' black ' ' red ' ' green ' ' yellow' ' blue ' 'magenta' ' cyan ' ' white ')
+BGNAMES=('DFT' 'BLK' 'RED' 'GRN' 'YEL' 'BLU' 'MAG' 'CYN' 'WHT')
+
+echo " ┌──────────────────────────────────────────────────────────────────────────┐"
+for b in {0..8}; do
+ ((b>0)) && bg=$((b+39))
+
+ echo -en "\033[0m ${BGNAMES[b]} │ "
+
+ for f in {0..7}; do
+ echo -en "\033[${bg}m\033[$((f+30))m ${FGNAMES[f]} "
+ done
+
+ echo -en "\033[0m │"
+ echo -en "\033[0m\n\033[0m │ "
+
+ for f in {0..7}; do
+ echo -en "\033[${bg}m\033[1;$((f+30))m ${FGNAMES[f]} "
+ done
+
+ echo -en "\033[0m │"
+ echo -e "\033[0m"
+
+ ((b<8)) &&
+ echo " ├──────────────────────────────────────────────────────────────────────────┤"
+done
+echo " └──────────────────────────────────────────────────────────────────────────┘"