1
0
mirror of https://github.com/Mayccoll/Gogh.git synced 2023-08-10 21:12:46 +03:00

Cleanup code

This commit is contained in:
phenonymous 2018-11-30 23:04:12 +01:00
parent 01f998e9ee
commit ef624d3ea9
2 changed files with 45 additions and 107 deletions

View File

@ -1,53 +1,33 @@
#!/usr/bin/env bash #!/usr/bin/env bash
trap 'unset GOGH_DRY_RUN; unset -f color; trap - EXIT' EXIT HUP INT QUIT PIPE TERM
if [[ "${COLORTERM:-}" != "truecolor" ]] && [[ "${COLORTERM:-}" != "24bit" ]]; then if [[ "${COLORTERM:-}" != "truecolor" ]] && [[ "${COLORTERM:-}" != "24bit" ]]; then
echo "TrueColor support is needed for this to function" printf '%s\n' "TrueColor support is needed for this to function" \
echo "You can try to manually set COLORTERM to truecolor" "You can try to manually set COLORTERM to truecolor"
exit 1 exit 1
fi fi
# Reset color
export RS="$(tput sgr0)"
# Print all themes without applying, this variable gets checked in apply-colors.sh # Print all themes without applying, this variable gets checked in apply-colors.sh
export GOGH_DRY_RUN=1 export GOGH_DRY_RUN=1
color () { color () {
# echo "" printf '%b\n' "${DEMO_COLOR_01} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 01 'tput setaf 0'" # black
#black printf '%b\n' "${DEMO_COLOR_02} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 02 'tput setaf 1'" # red
echo -e "${DEMO_COLOR_01} ███ *** AaBbCs --- ███ ${RS} ---> Color 01 'tput setaf 0'" printf '%b\n' "${DEMO_COLOR_03} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 03 'tput setaf 2'" # green
#red printf '%b\n' "${DEMO_COLOR_04} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 04 'tput setaf 3'" # yellow
echo -e "${DEMO_COLOR_02} ███ *** AaBbCs --- ███ ${RS} ---> Color 02 'tput setaf 1'" printf '%b\n' "${DEMO_COLOR_05} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 05 'tput setaf 4'" # blue
#green printf '%b\n' "${DEMO_COLOR_06} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 06 'tput setaf 5'" # pruple
echo -e "${DEMO_COLOR_03} ███ *** AaBbCs --- ███ ${RS} ---> Color 03 'tput setaf 2'" printf '%b\n' "${DEMO_COLOR_07} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 07 'tput setaf 6'" # cyan
#yellow printf '%b\n\n' "${DEMO_COLOR_08} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 08 'tput setaf 7'" # white
echo -e "${DEMO_COLOR_04} ███ *** AaBbCs --- ███ ${RS} ---> Color 04 'tput setaf 3'" printf '%b\n' "${DEMO_COLOR_09} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 09 'tput setaf 8'" # bold black
#blue printf '%b\n' "${DEMO_COLOR_10} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 10 'tput setaf 9'" # bold red
echo -e "${DEMO_COLOR_05} ███ *** AaBbCs --- ███ ${RS} ---> Color 05 'tput setaf 4'" printf '%b\n' "${DEMO_COLOR_11} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 11 'tput setaf 10'" # bold green
#purple printf '%b\n' "${DEMO_COLOR_12} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 12 'tput setaf 11'" # bold yellow
echo -e "${DEMO_COLOR_06} ███ *** AaBbCs --- ███ ${RS} ---> Color 06 'tput setaf 5'" printf '%b\n' "${DEMO_COLOR_13} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 13 'tput setaf 12'" # bold blue
#cyan printf '%b\n' "${DEMO_COLOR_14} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 14 'tput setaf 13'" # bold purple
echo -e "${DEMO_COLOR_07} ███ *** AaBbCs --- ███ ${RS} ---> Color 07 'tput setaf 6'" printf '%b\n' "${DEMO_COLOR_15} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 15 'tput setaf 14'" # bold cyan
#white printf '%b\n\n' "${DEMO_COLOR_16} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 16 'tput setaf 15'" # bold white
echo -e "${DEMO_COLOR_08} ███ *** AaBbCs --- ███ ${RS} ---> Color 08 'tput setaf 7'"
echo ""
#black
echo -e "${DEMO_COLOR_09} ███ *** AaBbCs --- ███ ${RS} ---> Color 09 'tput setaf 8'"
#red
echo -e "${DEMO_COLOR_10} ███ *** AaBbCs --- ███ ${RS} ---> Color 10 'tput setaf 9'"
#green
echo -e "${DEMO_COLOR_11} ███ *** AaBbCs --- ███ ${RS} ---> Color 11 'tput setaf 10'"
#yellow
echo -e "${DEMO_COLOR_12} ███ *** AaBbCs --- ███ ${RS} ---> Color 12 'tput setaf 11'"
#blue
echo -e "${DEMO_COLOR_13} ███ *** AaBbCs --- ███ ${RS} ---> Color 13 'tput setaf 12'"
#purple
echo -e "${DEMO_COLOR_14} ███ *** AaBbCs --- ███ ${RS} ---> Color 14 'tput setaf 13'"
#cyan
echo -e "${DEMO_COLOR_15} ███ *** AaBbCs --- ███ ${RS} ---> Color 15 'tput setaf 14'"
#white
echo -e "${DEMO_COLOR_16} ███ *** AaBbCs --- ███ ${RS} ---> Color 16 'tput setaf 15'"
echo ""
} }
export -f color export -f color
@ -293,5 +273,3 @@ LOOP=$((${LOOP:-(-1)}+1))
command -v bar::status_changed > /dev/null && bar::status_changed $LOOP ${#THEMES[@]} command -v bar::status_changed > /dev/null && bar::status_changed $LOOP ${#THEMES[@]}
command -v bar::stop > /dev/null && bar::stop || : command -v bar::stop > /dev/null && bar::stop || :
unset GOGH_DRY_RUN

View File

@ -1,71 +1,31 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Reset color
RS="\e[0m"
# Basic Colors
BLACK="\e[0;30m"
RED="\e[0;31m"
GREEN="\e[0;32m"
YELLOW="\e[0;33m"
BLUE="\e[0;34m"
PURPLE="\e[0;35m"
CYAN="\e[0;36m"
WHITE="\e[0;37m"
function_message_title () {
echo ""
echo ""
echo ""
echo ""
echo ""
echo -e "${CYAN}"
echo -e "# | ::::::::::::::::::::::::::::::::::::::::::::: | #"
echo -e "# | ${RS} $1 ${CYAN}"
echo -e "# | ::::::::::::::::::::::::::::::::::::::::::::: | #"
echo -e "${RS}"
}
color () { color () {
# echo "" printf '%s\n' "$(tput setaf 0 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 01 'tput setaf 0'" # black
#black printf '%s\n' "$(tput setaf 1 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 02 'tput setaf 1'" # red
echo -e "\e[0;30m ███ *** AaBbCs --- ███ \\e[0m ---> Color 01 0;30m" printf '%s\n' "$(tput setaf 2 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 03 'tput setaf 2'" # green
#red printf '%s\n' "$(tput setaf 3 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 04 'tput setaf 3'" # yellow
echo -e "\e[0;31m ███ *** AaBbCs --- ███ \\e[0m ---> Color 02 0;31m" printf '%s\n' "$(tput setaf 4 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 05 'tput setaf 4'" # blue
#green printf '%s\n' "$(tput setaf 5 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 06 'tput setaf 5'" # pruple
echo -e "\e[0;32m ███ *** AaBbCs --- ███ \\e[0m ---> Color 03 0;32m" printf '%s\n' "$(tput setaf 6 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 07 'tput setaf 6'" # cyan
#yellow printf '%s\n\n' "$(tput setaf 7 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 08 'tput setaf 7'" # white
echo -e "\e[0;33m ███ *** AaBbCs --- ███ \\e[0m ---> Color 04 0;33m" printf '%s\n' "$(tput setaf 8 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 09 'tput setaf 8'" # bold black
#blue printf '%s\n' "$(tput setaf 9 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 10 'tput setaf 9'" # bold red
echo -e "\e[0;34m ███ *** AaBbCs --- ███ \\e[0m ---> Color 05 0;34m" printf '%s\n' "$(tput setaf 10) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 11 'tput setaf 10'" # bold green
#purple printf '%s\n' "$(tput setaf 11) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 12 'tput setaf 11'" # bold yellow
echo -e "\e[0;35m ███ *** AaBbCs --- ███ \\e[0m ---> Color 06 0;35m" printf '%s\n' "$(tput setaf 12) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 13 'tput setaf 12'" # bold blue
#cyan printf '%s\n' "$(tput setaf 13) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 14 'tput setaf 13'" # bold purple
echo -e "\e[0;36m ███ *** AaBbCs --- ███ \\e[0m ---> Color 07 0;36m" printf '%s\n' "$(tput setaf 14) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 15 'tput setaf 14'" # bold cyan
#white printf '%s\n\n' "$(tput setaf 15) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 16 'tput setaf 15'" # bold white
echo -e "\e[0;37m ███ *** AaBbCs --- ███ \\e[0m ---> Color 08 0;37m"
echo "" local color_str
#black for c in {0..15}; do
echo -e "\e[1;30m ███ *** AaBbCs --- ███ \\e[0m ---> Color 09 1;30m" color_dot_str+="$(tput setaf $c)$(tput sgr0)"
#red [[ $c == 7 ]] && color_dot_str+=" "
echo -e "\e[1;31m ███ *** AaBbCs --- ███ \\e[0m ---> Color 10 1;31m" done
#green printf '%s\n' "$color_str"
echo -e "\e[1;32m ███ *** AaBbCs --- ███ \\e[0m ---> Color 11 1;32m" unset color_str
#yellow
echo -e "\e[1;33m ███ *** AaBbCs --- ███ \\e[0m ---> Color 12 1;33m"
#blue
echo -e "\e[1;34m ███ *** AaBbCs --- ███ \\e[0m ---> Color 13 1;34m"
#purple
echo -e "\e[1;35m ███ *** AaBbCs --- ███ \\e[0m ---> Color 14 1;35m"
#cyan
echo -e "\e[1;36m ███ *** AaBbCs --- ███ \\e[0m ---> Color 15 1;36m"
#white
echo -e "\e[1;37m ███ *** AaBbCs --- ███ \\e[0m ---> Color 16 1;37m"
echo ""
echo -e "\e[0;30m█████\\e[0m\e[0;31m█████\\e[0m\e[0;32m█████\\e[0m\e[0;33m█████\\e[0m\e[0;34m█████\\e[0m\e[0;35m█████\\e[0m\e[0;36m█████\\e[0m\e[0;37m█████\\e[0m"
echo -e "\e[0m\e[1;30m█████\\e[0m\e[1;31m█████\\e[0m\e[1;32m█████\\e[0m\e[1;33m█████\\e[0m\e[1;34m█████\\e[0m\e[1;35m█████\\e[0m\e[1;36m█████\\e[0m\e[1;37m█████\\e[0m"
} }