From 82393a324e40959e3e045e1136cff25d99667f20 Mon Sep 17 00:00:00 2001 From: Stefan Gaiselmann Date: Wed, 3 Feb 2021 15:31:31 +0100 Subject: [PATCH] Added short version of color test function (less verbose). --- bin/executable_color-test.sh | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/bin/executable_color-test.sh b/bin/executable_color-test.sh index 2353766..9e10da2 100755 --- a/bin/executable_color-test.sh +++ b/bin/executable_color-test.sh @@ -5,9 +5,10 @@ # and/or modify it under the terms of the Do What The Fuck You Want # To Public License, Version 2, as published by Sam Hocevar. See # http://sam.zoy.org/wtfpl/COPYING for more details. - + +function printFullColors() { #Background -for clbg in {40..47} {100..107} 49 ; do + for clbg in {40..47} {100..107} 49 ; do #Foreground for clfg in {30..37} {90..97} 39 ; do #Formatting @@ -17,8 +18,28 @@ for clbg in {40..47} {100..107} 49 ; do done echo #Newline done -done - + done +} + +# See https://askubuntu.com/questions/27314/script-to-display-all-terminal-colors +function printShortColors() { + for x in {0..8}; do + for i in {30..37}; do + for a in {40..47}; do + echo -ne "\e[$x;$i;$a""m\\\e[$x;$i;$a""m\e[0;37;40m " + done + echo + done + done + echo "" +} + +if [ "$1" == "--full" ]; then + printFullColors +else + printShortColors +fi + exit 0