From f8e5d4a77a6ca90541c23a54bef39f77f3fef84b Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Fri, 3 Nov 2017 18:26:47 +0800 Subject: Rename several term color test scripts * Change shebang to '#!/usr/bin/env bash' * Change suffix to '.bash' --- unix/colors.sh | 37 ----------------------------------- unix/colortest.sh | 53 -------------------------------------------------- unix/colortest2.bash | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ unix/term_color.sh | 28 -------------------------- unix/term_color_2.sh | 32 ------------------------------ unix/termcolors1.bash | 40 ++++++++++++++++++++++++++++++++++++++ unix/termcolors2.bash | 32 ++++++++++++++++++++++++++++++ 7 files changed, 126 insertions(+), 150 deletions(-) delete mode 100755 unix/colors.sh delete mode 100755 unix/colortest.sh create mode 100755 unix/colortest2.bash delete mode 100755 unix/term_color.sh delete mode 100755 unix/term_color_2.sh create mode 100755 unix/termcolors1.bash create mode 100755 unix/termcolors2.bash diff --git a/unix/colors.sh b/unix/colors.sh deleted file mode 100755 index a28c261..0000000 --- a/unix/colors.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# https://gist.github.com/esundahl/1651086 - -function color_test { - # Daniel Crisman's ANSI color chart script from - # The Bash Prompt HOWTO: 6.1. Colours - # http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html - # - # This function echoes a bunch of color codes to the - # terminal to demonstrate what's available. Each - # line is the color code of one forground color, - # out of 17 (default + 16 escapes), followed by a - # test use of that color on all nine background - # colors (default + 8 escapes). - # - - T='gYw' # The test text - - echo -e "\n 40m 41m 42m 43m\ - 44m 45m 46m 47m" - - for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' \ - ' 32m' '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' \ - ' 35m' '1;35m' ' 36m' '1;36m' ' 37m' '1;37m'; - do - FG=${FGs// /} - echo -en " $FGs \033[$FG $T " - for BG in 40m 41m 42m 43m 44m 45m 46m 47m; do - echo -en "$EINS \033[$FG\033[$BG $T \033[0m" - done - echo; - done - echo -} - -color_test - diff --git a/unix/colortest.sh b/unix/colortest.sh deleted file mode 100755 index 3974d69..0000000 --- a/unix/colortest.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# Original Posted at http://crunchbang.org/forums/viewtopic.php?pid=126921%23p126921#p126921 -# [ESC] character in original post removed here. - -# ANSI Color -- use these variables to easily have different color -# and format output. Make sure to output the reset sequence after -# colors (f = foreground, b = background), and use the 'off' -# feature for anything you turn on. - -initializeANSI() -{ - esc="$(echo -en '\e')" - - blackf="${esc}[30m"; redf="${esc}[31m"; greenf="${esc}[32m" - yellowf="${esc}[33m" bluef="${esc}[34m"; purplef="${esc}[35m" - cyanf="${esc}[36m"; whitef="${esc}[37m" - - blackb="${esc}[40m"; redb="${esc}[41m"; greenb="${esc}[42m" - yellowb="${esc}[43m" blueb="${esc}[44m"; purpleb="${esc}[45m" - cyanb="${esc}[46m"; whiteb="${esc}[47m" - - boldon="${esc}[1m"; boldoff="${esc}[22m" - italicson="${esc}[3m"; italicsoff="${esc}[23m" - ulon="${esc}[4m"; uloff="${esc}[24m" - invon="${esc}[7m"; invoff="${esc}[27m" - - reset="${esc}[0m" -} - -# note in this first use that switching colors doesn't require a reset -# first - the new color overrides the old one. - -#clear - -initializeANSI - -cat << EOF - - ${yellowf} ▄███████▄${reset} ${redf} ▄██████▄${reset} ${greenf} ▄██████▄${reset} ${bluef} ▄██████▄${reset} ${purplef} ▄██████▄${reset} ${cyanf} ▄██████▄${reset} - ${yellowf}▄█████████▀▀${reset} ${redf}▄${whitef}█▀█${redf}██${whitef}█▀█${redf}██▄${reset} ${greenf}▄${whitef}█▀█${greenf}██${whitef}█▀█${greenf}██▄${reset} ${bluef}▄${whitef}█▀█${bluef}██${whitef}█▀█${bluef}██▄${reset} ${purplef}▄${whitef}█▀█${purplef}██${whitef}█▀█${purplef}██▄${reset} ${cyanf}▄${whitef}█▀█${cyanf}██${whitef}█▀█${cyanf}██▄${reset} - ${yellowf}███████▀${reset} ${redf}█${whitef}▄▄█${redf}██${whitef}▄▄█${redf}███${reset} ${greenf}█${whitef}▄▄█${greenf}██${whitef}▄▄█${greenf}███${reset} ${bluef}█${whitef}▄▄█${bluef}██${whitef}▄▄█${bluef}███${reset} ${purplef}█${whitef}▄▄█${purplef}██${whitef}▄▄█${purplef}███${reset} ${cyanf}█${whitef}▄▄█${cyanf}██${whitef}▄▄█${cyanf}███${reset} - ${yellowf}███████▄${reset} ${redf}████████████${reset} ${greenf}████████████${reset} ${bluef}████████████${reset} ${purplef}████████████${reset} ${cyanf}████████████${reset} - ${yellowf}▀█████████▄▄${reset} ${redf}██▀██▀▀██▀██${reset} ${greenf}██▀██▀▀██▀██${reset} ${bluef}██▀██▀▀██▀██${reset} ${purplef}██▀██▀▀██▀██${reset} ${cyanf}██▀██▀▀██▀██${reset} - ${yellowf} ▀███████▀${reset} ${redf}▀ ▀ ▀ ▀${reset} ${greenf}▀ ▀ ▀ ▀${reset} ${bluef}▀ ▀ ▀ ▀${reset} ${purplef}▀ ▀ ▀ ▀${reset} ${cyanf}▀ ▀ ▀ ▀${reset} - - ${boldon}${yellowf} ▄███████▄ ${redf} ▄██████▄ ${greenf} ▄██████▄ ${bluef} ▄██████▄ ${purplef} ▄██████▄ ${cyanf} ▄██████▄${reset} - ${boldon}${yellowf}▄█████████▀▀ ${redf}▄${whitef}█▀█${redf}██${whitef}█▀█${redf}██▄ ${greenf}▄${whitef}█▀█${greenf}██${whitef}█▀█${greenf}██▄ ${bluef}▄${whitef}█▀█${bluef}██${whitef}█▀█${bluef}██▄ ${purplef}▄${whitef}█▀█${purplef}██${whitef}█▀█${purplef}██▄ ${cyanf}▄${whitef}█▀█${cyanf}██${whitef}█▀█${cyanf}██▄${reset} - ${boldon}${yellowf}███████▀ ${redf}█${whitef}▄▄█${redf}██${whitef}▄▄█${redf}███ ${greenf}█${whitef}▄▄█${greenf}██${whitef}▄▄█${greenf}███ ${bluef}█${whitef}▄▄█${bluef}██${whitef}▄▄█${bluef}███ ${purplef}█${whitef}▄▄█${purplef}██${whitef}▄▄█${purplef}███ ${cyanf}█${whitef}▄▄█${cyanf}██${whitef}▄▄█${cyanf}███${reset} - ${boldon}${yellowf}███████▄ ${redf}████████████ ${greenf}████████████ ${bluef}████████████ ${purplef}████████████ ${cyanf}████████████${reset} - ${boldon}${yellowf}▀█████████▄▄ ${redf}██▀██▀▀██▀██ ${greenf}██▀██▀▀██▀██ ${bluef}██▀██▀▀██▀██ ${purplef}██▀██▀▀██▀██ ${cyanf}██▀██▀▀██▀██${reset} - ${boldon}${yellowf} ▀███████▀ ${redf}▀ ▀ ▀ ▀ ${greenf}▀ ▀ ▀ ▀ ${bluef}▀ ▀ ▀ ▀ ${purplef}▀ ▀ ▀ ▀ ${cyanf}▀ ▀ ▀ ▀${reset} - -EOF diff --git a/unix/colortest2.bash b/unix/colortest2.bash new file mode 100755 index 0000000..198399c --- /dev/null +++ b/unix/colortest2.bash @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +# +# Original Posted at http://crunchbang.org/forums/viewtopic.php?pid=126921%23p126921#p126921 +# [ESC] character in original post removed here. + +# ANSI Color -- use these variables to easily have different color +# and format output. Make sure to output the reset sequence after +# colors (f = foreground, b = background), and use the 'off' +# feature for anything you turn on. + +initializeANSI() +{ + esc="$(echo -en '\e')" + + blackf="${esc}[30m"; redf="${esc}[31m"; greenf="${esc}[32m" + yellowf="${esc}[33m" bluef="${esc}[34m"; purplef="${esc}[35m" + cyanf="${esc}[36m"; whitef="${esc}[37m" + + blackb="${esc}[40m"; redb="${esc}[41m"; greenb="${esc}[42m" + yellowb="${esc}[43m" blueb="${esc}[44m"; purpleb="${esc}[45m" + cyanb="${esc}[46m"; whiteb="${esc}[47m" + + boldon="${esc}[1m"; boldoff="${esc}[22m" + italicson="${esc}[3m"; italicsoff="${esc}[23m" + ulon="${esc}[4m"; uloff="${esc}[24m" + invon="${esc}[7m"; invoff="${esc}[27m" + + reset="${esc}[0m" +} + +# note in this first use that switching colors doesn't require a reset +# first - the new color overrides the old one. + +#clear + +initializeANSI + +cat << EOF + + ${yellowf} ▄███████▄${reset} ${redf} ▄██████▄${reset} ${greenf} ▄██████▄${reset} ${bluef} ▄██████▄${reset} ${purplef} ▄██████▄${reset} ${cyanf} ▄██████▄${reset} + ${yellowf}▄█████████▀▀${reset} ${redf}▄${whitef}█▀█${redf}██${whitef}█▀█${redf}██▄${reset} ${greenf}▄${whitef}█▀█${greenf}██${whitef}█▀█${greenf}██▄${reset} ${bluef}▄${whitef}█▀█${bluef}██${whitef}█▀█${bluef}██▄${reset} ${purplef}▄${whitef}█▀█${purplef}██${whitef}█▀█${purplef}██▄${reset} ${cyanf}▄${whitef}█▀█${cyanf}██${whitef}█▀█${cyanf}██▄${reset} + ${yellowf}███████▀${reset} ${redf}█${whitef}▄▄█${redf}██${whitef}▄▄█${redf}███${reset} ${greenf}█${whitef}▄▄█${greenf}██${whitef}▄▄█${greenf}███${reset} ${bluef}█${whitef}▄▄█${bluef}██${whitef}▄▄█${bluef}███${reset} ${purplef}█${whitef}▄▄█${purplef}██${whitef}▄▄█${purplef}███${reset} ${cyanf}█${whitef}▄▄█${cyanf}██${whitef}▄▄█${cyanf}███${reset} + ${yellowf}███████▄${reset} ${redf}████████████${reset} ${greenf}████████████${reset} ${bluef}████████████${reset} ${purplef}████████████${reset} ${cyanf}████████████${reset} + ${yellowf}▀█████████▄▄${reset} ${redf}██▀██▀▀██▀██${reset} ${greenf}██▀██▀▀██▀██${reset} ${bluef}██▀██▀▀██▀██${reset} ${purplef}██▀██▀▀██▀██${reset} ${cyanf}██▀██▀▀██▀██${reset} + ${yellowf} ▀███████▀${reset} ${redf}▀ ▀ ▀ ▀${reset} ${greenf}▀ ▀ ▀ ▀${reset} ${bluef}▀ ▀ ▀ ▀${reset} ${purplef}▀ ▀ ▀ ▀${reset} ${cyanf}▀ ▀ ▀ ▀${reset} + + ${boldon}${yellowf} ▄███████▄ ${redf} ▄██████▄ ${greenf} ▄██████▄ ${bluef} ▄██████▄ ${purplef} ▄██████▄ ${cyanf} ▄██████▄${reset} + ${boldon}${yellowf}▄█████████▀▀ ${redf}▄${whitef}█▀█${redf}██${whitef}█▀█${redf}██▄ ${greenf}▄${whitef}█▀█${greenf}██${whitef}█▀█${greenf}██▄ ${bluef}▄${whitef}█▀█${bluef}██${whitef}█▀█${bluef}██▄ ${purplef}▄${whitef}█▀█${purplef}██${whitef}█▀█${purplef}██▄ ${cyanf}▄${whitef}█▀█${cyanf}██${whitef}█▀█${cyanf}██▄${reset} + ${boldon}${yellowf}███████▀ ${redf}█${whitef}▄▄█${redf}██${whitef}▄▄█${redf}███ ${greenf}█${whitef}▄▄█${greenf}██${whitef}▄▄█${greenf}███ ${bluef}█${whitef}▄▄█${bluef}██${whitef}▄▄█${bluef}███ ${purplef}█${whitef}▄▄█${purplef}██${whitef}▄▄█${purplef}███ ${cyanf}█${whitef}▄▄█${cyanf}██${whitef}▄▄█${cyanf}███${reset} + ${boldon}${yellowf}███████▄ ${redf}████████████ ${greenf}████████████ ${bluef}████████████ ${purplef}████████████ ${cyanf}████████████${reset} + ${boldon}${yellowf}▀█████████▄▄ ${redf}██▀██▀▀██▀██ ${greenf}██▀██▀▀██▀██ ${bluef}██▀██▀▀██▀██ ${purplef}██▀██▀▀██▀██ ${cyanf}██▀██▀▀██▀██${reset} + ${boldon}${yellowf} ▀███████▀ ${redf}▀ ▀ ▀ ▀ ${greenf}▀ ▀ ▀ ▀ ${bluef}▀ ▀ ▀ ▀ ${purplef}▀ ▀ ▀ ▀ ${cyanf}▀ ▀ ▀ ▀${reset} + +EOF diff --git a/unix/term_color.sh b/unix/term_color.sh deleted file mode 100755 index f10f916..0000000 --- a/unix/term_color.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash -# -# This file echoes a bunch of color codes to the -# terminal to demonstrate what's available. Each -# line is the color code of one forground color, -# out of 17 (default + 16 escapes), followed by a -# test use of that color on all nine background -# colors (default + 8 escapes). -# -# Ref: https://wiki.archlinux.org/index.php/X_resources -# - -T='gYw' # The test text - -echo -e "\n 40m 41m 42m 43m\ - 44m 45m 46m 47m"; - -for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \ - '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \ - ' 36m' '1;36m' ' 37m' '1;37m'; - do FG=${FGs// /} - echo -en " $FGs \033[$FG $T " - for BG in 40m 41m 42m 43m 44m 45m 46m 47m; - do echo -en "$EINS \033[$FG\033[$BG $T \033[0m"; - done - echo; -done -echo diff --git a/unix/term_color_2.sh b/unix/term_color_2.sh deleted file mode 100755 index 4dc2ef2..0000000 --- a/unix/term_color_2.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/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 " └──────────────────────────────────────────────────────────────────────────┘" diff --git a/unix/termcolors1.bash b/unix/termcolors1.bash new file mode 100755 index 0000000..f9efa62 --- /dev/null +++ b/unix/termcolors1.bash @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# +# * https://gist.github.com/esundahl/1651086 +# * https://wiki.archlinux.org/index.php/X_resources +# + +function color_test { + # Daniel Crisman's ANSI color chart script from + # The Bash Prompt HOWTO: 6.1. Colours + # http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html + # + # This function echoes a bunch of color codes to the + # terminal to demonstrate what's available. Each + # line is the color code of one forground color, + # out of 17 (default + 16 escapes), followed by a + # test use of that color on all nine background + # colors (default + 8 escapes). + # + + T='gYw' # The test text + + echo -e "\n 40m 41m 42m 43m\ + 44m 45m 46m 47m" + + for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' \ + ' 32m' '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' \ + ' 35m' '1;35m' ' 36m' '1;36m' ' 37m' '1;37m'; + do + FG=${FGs// /} + echo -en " $FGs \033[$FG $T " + for BG in 40m 41m 42m 43m 44m 45m 46m 47m; do + echo -en "$EINS \033[$FG\033[$BG $T \033[0m" + done + echo; + done + echo +} + +color_test + diff --git a/unix/termcolors2.bash b/unix/termcolors2.bash new file mode 100755 index 0000000..4dc2ef2 --- /dev/null +++ b/unix/termcolors2.bash @@ -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 " └──────────────────────────────────────────────────────────────────────────┘" -- cgit v1.2.2