# HG changeset patch # User Aleksej Bobylev # Date 1435701677 -10800 # Node ID 3a790a1821038549af9e5aafc0ead829d4f51679 # Parent 5979e3b76e5e78ec8cde9c29cd127ddd31c26847 libtaz.sh: non-bold colors starts with 0; add available color table to the testsuite diff -r 5979e3b76e5e -r 3a790a182103 rootfs/lib/libtaz.sh --- a/rootfs/lib/libtaz.sh Sat Jun 20 22:49:35 2015 +0300 +++ b/rootfs/lib/libtaz.sh Wed Jul 01 01:01:17 2015 +0300 @@ -7,6 +7,7 @@ # . /usr/bin/gettext.sh +alias sed="busybox sed" # Internal lgettext() { gettext -d 'slitaz-base' "$@"; } @@ -102,7 +103,10 @@ case $output in raw|gtk) echo "$@";; html) echo -n "$@";; - *) echo -e "\\033[1;${color:-38}m$@\\033[0;39m" ;; + *) case $color in + 0*) echo -e "\\033[${color:-38}m$@\\033[39m";; + *) echo -e "\\033[1;${color:-38}m$@\\033[0;39m";; + esac;; esac unset color } @@ -136,7 +140,8 @@ sep="${sep}=" done echo -en "$(echo "$@" | sed -e 's||\\033[1m|g; s||\\033[0m|g; - s||\\033[1;\1m|g; s||\\033[0;39m|g; s||\n|g; + s||\\033[\1m|g; s||\\033[1;\1m|g; + s||\\033[0;39m|g; s||\n|g; s|<->|'$sep'|g; s||\\033[\1G|g')" [ "$1" != "-n" ] && echo ;; diff -r 5979e3b76e5e -r 3a790a182103 testsuite.sh --- a/testsuite.sh Sat Jun 20 22:49:35 2015 +0300 +++ b/testsuite.sh Wed Jul 01 01:01:17 2015 +0300 @@ -79,6 +79,25 @@ newline; echo 'Using itemize() in the tazpkg:' tazpkg info gtk+ + + title "$(emsg 'Colors')" + for i in $(seq 0 7); do + case $i in + 0) c='Gray ';; + 1) c='Red ';; + 2) c='Green ';; + 3) c='Yellow ';; + 4) c='Blue ';; + 5) c='Magenta';; + 6) c='Cyan ';; + 7) c='White ';; + esac + echo -n "$c " + echo -n "$(colorize "03$i" "03$i") $(colorize "3$i" "3$i") " # test `colorize`: fg + echo -n "$(colorize "04$i" "04$i") $(colorize "4$i" "4$i") " # test `colorize`: bg + echo -n ": " + emsg "03$i $c 3$i Bold $c 04$i $c 4$i Bold $c" # test `emsg` + done } # Usage: check_functions path/to/lib.sh