From e85ba05af21a3ac95bae894a0f5302d05f414be6 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Thu, 8 Apr 2010 11:16:21 +0200 Subject: [PATCH] Bash script for colors table --- scripts/color-bash.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 scripts/color-bash.sh diff --git a/scripts/color-bash.sh b/scripts/color-bash.sh new file mode 100755 index 0000000..b4ba25e --- /dev/null +++ b/scripts/color-bash.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# exemple echo -e "\033[31m ROUGE \033[0m" +# prints a color table of 8bg * 8fg * 2 states (regular/bold) +echo +echo Table for 16-color terminal escape sequences. +echo Replace ESC with \\033 in bash. +echo +echo "Background | Foreground colors" +echo "---------------------------------------------------------------------" +for((bg=40;bg<=47;bg++)); do + for((bold=0;bold<=1;bold++)) do + echo -en "\033[0m"" ESC[${bg}m | " + for((fg=30;fg<=37;fg++)); do + if [ $bold == "0" ]; then + echo -en "\033[${bg}m\033[${fg}m [${fg}m " + else + echo -en "\033[${bg}m\033[1;${fg}m [1;${fg}m" + fi + done + echo -e "\033[0m" + done + echo "--------------------------------------------------------------------- " +done + +echo +echo