summaryrefslogtreecommitdiff
path: root/.bashrc
diff options
context:
space:
mode:
Diffstat (limited to '.bashrc')
-rw-r--r--.bashrc65
1 files changed, 65 insertions, 0 deletions
diff --git a/.bashrc b/.bashrc
index 53a7c46..09930fc 100644
--- a/.bashrc
+++ b/.bashrc
@@ -383,6 +383,71 @@ EOF
bind '"\C-h": backward-kill-word'
# }}}
+# ANSI tests {{{
+ try_code() {
+ local type=$1
+ local val=$2
+ local mod=$3
+
+ case "$val" in
+ (n) echo; return ;;
+ esac
+
+ case "$type" in
+ (sgr) printf "\e[${mod}${val}m% 3s\e[0m " "$val" ;;
+ esac
+ }
+
+ colors() {
+ echo 'SGR format: \e[X;Y;Z;...m'
+ echo '== Modifiers =='
+ for i in {0..9} n {10..20} n {21..29} n {50..62} n {63..75}
+ do
+ try_code sgr "$i"
+ done
+ echo
+ echo '== 4 bit colors =='
+ echo '\e[Xm'
+ for i in {30..37} n {40..47} n {90..97} n {100..107}
+ do
+ try_code sgr "$i"
+ done
+ echo
+
+ echo '== 8 bit colors =='
+ echo '\e[38;5;Xm'
+ for i in {0..7} n {8..15} n \
+ n \
+ {16..33} n {34..51} n \
+ {52..69} n {70..87} n \
+ {88..105} n {106..123} n \
+ {124..141} n {142..159} n \
+ {160..177} n {178..195} n \
+ {196..213} n {214..231} n \
+ n \
+ {232..243} n {244..255}
+ do
+ try_code sgr "$i" '38;5;'
+ done
+ echo
+ echo '\e[48;5;Xm'
+ for i in {0..7} n {8..15} n \
+ n \
+ {16..33} n {34..51} n \
+ {52..69} n {70..87} n \
+ {88..105} n {106..123} n \
+ {124..141} n {142..159} n \
+ {160..177} n {178..195} n \
+ {196..213} n {214..231} n \
+ n \
+ {232..243} n {244..255}
+ do
+ printf '\e[30m'
+ try_code sgr "$i" '48;5;'
+ done
+ echo
+ }
+# }}}
if [ -n "$ZSHRC_FUNTOO" ]
then