-#! /bin/bash
-set -e
-
-
-mainFunction () {
- echo
- printColors
- printGuidelines
-}
-
-
-printColor () {
- local color="${1}"
-
- printf "\033[1;4%sm " "${color}"
- printf "\033[0m "
- printf "\033[1;3%smSampleText " "${color}"
- printf "\033[0;3%smSampleText " "${color}"
- printf "\033[0m\n"
-}
-
-
-printColors () {
- local color
- # 0 black
- # 1 red
- # 2 green
- # 3 yellow
- # 4 blue
- # 5 magenta / orange
- # 6 cyan / purple
- # 7 white
-
- for color in 0 7; do
- printColor "${color}"
- done
- echo
-
- for color in 4 5 6; do
- printColor "${color}"
- done
- echo
-
- for color in 2 3 1; do
- printColor "${color}"
- done
- echo
-}
-
-
-printGuidelines () {
- echo "A good palette has:"
- echo "- All colors easy to read."
- echo "- Similar eye catchiness within the same group, except for monochromes."
- echo "- Similar or greater eye catchiness in upper groups, including this text."
- echo "- Similar color within the same line."
- echo "- The last group as: green yellow red."
- echo
-}
-
-
-mainFunction
+#!/bin/bash
+
+case $1 in
+ 1)
+ set -e
+ mainFunction () {
+ echo
+ printColors
+ printGuidelines
+ }
+
+
+ printColor () {
+ local color="${1}"
+
+ printf "\033[1;4%sm " "${color}"
+ printf "\033[0m "
+ printf "\033[1;3%smSampleText " "${color}"
+ printf "\033[0;3%smSampleText " "${color}"
+ printf "\033[0m\n"
+ }
+
+
+ printColors () {
+ local color
+ # 0 black
+ # 1 red
+ # 2 green
+ # 3 yellow
+ # 4 blue
+ # 5 magenta / orange
+ # 6 cyan / purple
+ # 7 white
+
+ for color in 0 7; do
+ printColor "${color}"
+ done
+ echo
+
+ for color in 4 5 6; do
+ printColor "${color}"
+ done
+ echo
+
+ for color in 2 3 1; do
+ printColor "${color}"
+ done
+ echo
+ }
+
+
+ printGuidelines () {
+ echo "A good palette has:"
+ echo "- All colors easy to read."
+ echo "- Similar eye catchiness within the same group, except for monochromes."
+ echo "- Similar or greater eye catchiness in upper groups, including this text."
+ echo "- Similar color within the same line."
+ echo "- The last group as: green yellow red."
+ echo
+ }
+
+
+ mainFunction;;
+
+ 2)
+ echo -e "\033[0mNC (No color)"
+ echo -e "\033[1;37mWHITE\t\033[0;30mBLACK"
+ echo -e "\033[0;34mBLUE\t\033[1;34mLIGHT_BLUE"
+ echo -e "\033[0;32mGREEN\t\033[1;32mLIGHT_GREEN"
+ echo -e "\033[0;36mCYAN\t\033[1;36mLIGHT_CYAN"
+ echo -e "\033[0;31mRED\t\033[1;31mLIGHT_RED"
+ echo -e "\033[0;35mPURPLE\t\033[1;35mLIGHT_PURPLE"
+ echo -e "\033[0;33mYELLOW\t\033[1;33mLIGHT_YELLOW"
+ echo -e "\033[1;30mGRAY\t\033[0;37mLIGHT_GRAY";;
+ 3)
+ # Description:
+ #
+ # Prints a color table of 8bg * 8fg * 2 states (regular/bold)
+ #
+ # Copyright:
+ #
+ # (C) 2009 Wolfgang Frisch <xororand@unfoog.de>
+ #
+ # License:
+ #
+ # This program is free software: you can redistribute it and/or modify
+ # it under the terms of the GNU General Public License as published by
+ # the Free Software Foundation, either version 3 of the License, or
+ # (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ 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;;
+ 4)
+ for colour in {1..225}
+ do echo -en "\033[38;5;${colour}m38;5;${colour} \n"
+ done | column -x;;
+ *)
+ colors 1
+ echo "Enter a number [1-4] to specify, which demo to run.";;
+esac
+
+++ /dev/null
-#!/bin/bash
-
-case $1 in
- 1)
- set -e
-
-
- mainFunction () {
- echo
- printColors
- printGuidelines
- }
-
-
- printColor () {
- local color="${1}"
-
- printf "\033[1;4%sm " "${color}"
- printf "\033[0m "
- printf "\033[1;3%smSampleText " "${color}"
- printf "\033[0;3%smSampleText " "${color}"
- printf "\033[0m\n"
- }
-
-
- printColors () {
- local color
- # 0 black
- # 1 red
- # 2 green
- # 3 yellow
- # 4 blue
- # 5 magenta / orange
- # 6 cyan / purple
- # 7 white
-
- for color in 0 7; do
- printColor "${color}"
- done
- echo
-
- for color in 4 5 6; do
- printColor "${color}"
- done
- echo
-
- for color in 2 3 1; do
- printColor "${color}"
- done
- echo
- }
-
-
- printGuidelines () {
- echo "A good palette has:"
- echo "- All colors easy to read."
- echo "- Similar eye catchiness within the same group, except for monochromes."
- echo "- Similar or greater eye catchiness in upper groups, including this text."
- echo "- Similar color within the same line."
- echo "- The last group as: green yellow red."
- echo
- }
-
-
- mainFunction;;
-
- 2)
- echo -e "\033[0mNC (No color)"
- echo -e "\033[1;37mWHITE\t\033[0;30mBLACK"
- echo -e "\033[0;34mBLUE\t\033[1;34mLIGHT_BLUE"
- echo -e "\033[0;32mGREEN\t\033[1;32mLIGHT_GREEN"
- echo -e "\033[0;36mCYAN\t\033[1;36mLIGHT_CYAN"
- echo -e "\033[0;31mRED\t\033[1;31mLIGHT_RED"
- echo -e "\033[0;35mPURPLE\t\033[1;35mLIGHT_PURPLE"
- echo -e "\033[0;33mYELLOW\t\033[1;33mLIGHT_YELLOW"
- echo -e "\033[1;30mGRAY\t\033[0;37mLIGHT_GRAY";;
- 3)
- # Description:
- #
- # Prints a color table of 8bg * 8fg * 2 states (regular/bold)
- #
- # Copyright:
- #
- # (C) 2009 Wolfgang Frisch <xororand@unfoog.de>
- #
- # License:
- #
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
-
- 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;;
- 4)
- for colour in {1..225}
- do echo -en "\033[38;5;${colour}m38;5;${colour} \n"
- done | column -x;;
- *)
- colr 1
- echo "Enter a number [1-4] to specify, which demo to run.";;
-esac
-