Created
October 2, 2020 04:57
-
-
Save joshbduncan/0917236fc4e4c27b7fa915a13231ef1c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# https://misc.flogisoft.com/bash/tip_colors_and_formatting#colors | |
# TEXT COLOR | |
DEFAULT="\033[0m" | |
BLACK="\033[30m" | |
RED="\033[31m" | |
GREEN="\033[32m" | |
ORANGE="\033[33m" | |
BLUE="\033[34m" | |
PURPLE="\033[35m" | |
CYAN="\033[36m" | |
LIGHTGRAY="\033[37m" | |
DARKGRAY="\033[1;30m" | |
LIGHTRED="\033[1;31m" | |
LIGHTGREEN="\033[1;32m" | |
YELLOW="\033[1;33m" | |
LIGHTBLUE="\033[1;34m" | |
LIGHTPURPLE="\033[1;35m" | |
LIGHTCYAN="\033[1;36m" | |
WHITE="\033[1;37m" | |
# BACKGROUND COLOR | |
BG_DEFAULT="\033[049m" | |
BG_BLACK="\033[40m" | |
BG_RED="\033[41m" | |
BG_GREEN="\033[42m" | |
BG_ORANGE="\033[43m" | |
BG_BLUE="\033[44m" | |
BG_PURPLE="\033[45m" | |
BG_CYAN="\033[46m" | |
BG_LIGHTGRAY="\033[47m" | |
BG_DARKGRAY="\033[100m" | |
BG_LIGHTRED="\033[101m" | |
BG_LIGHTGREEN="\033[102m" | |
BG_YELLOW="\033[103m" | |
BG_LIGHTBLUE="\033[104m" | |
BG_LIGHTPURPLE="\033[105m" | |
BG_LIGHTCYAN="\033[106m" | |
BG_WHITE="\033[107m" | |
COLORS=("DEFAULT" "BLACK" "RED" "GREEN" "ORANGE" "BLUE" "PURPLE" "CYAN" "LIGHTGRAY" "DARKGRAY" "LIGHTRED" "LIGHTGREEN" "YELLOW" "LIGHTBLUE" "LIGHTPURPLE" "LIGHTCYAN" "WHITE") | |
for color in "${COLORS[@]}" | |
do | |
bg_color="BG_"${color} | |
echo -en ${!color} | |
echo -n "${color} => ${!color} " | |
echo -en ${!bg_color} | |
if [ "$color" = "WHITE" ]; then | |
echo -en ${BLACK} | |
else | |
echo -en ${WHITE} | |
fi | |
echo -n ${!bg_color} | |
echo -e ${BG_DEFAULT}${DEFAULT} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment