mirror of
https://github.com/Mayccoll/Gogh.git
synced 2023-08-10 21:12:46 +03:00
Cleanup code
This commit is contained in:
parent
01f998e9ee
commit
ef624d3ea9
@ -1,53 +1,33 @@
|
||||
#!/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
|
||||
echo "TrueColor support is needed for this to function"
|
||||
echo "You can try to manually set COLORTERM to truecolor"
|
||||
printf '%s\n' "TrueColor support is needed for this to function" \
|
||||
"You can try to manually set COLORTERM to truecolor"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Reset color
|
||||
export RS="$(tput sgr0)"
|
||||
|
||||
# Print all themes without applying, this variable gets checked in apply-colors.sh
|
||||
export GOGH_DRY_RUN=1
|
||||
|
||||
color () {
|
||||
# echo ""
|
||||
#black
|
||||
echo -e "${DEMO_COLOR_01} ███ *** AaBbCs --- ███ ${RS} ---> Color 01 'tput setaf 0'"
|
||||
#red
|
||||
echo -e "${DEMO_COLOR_02} ███ *** AaBbCs --- ███ ${RS} ---> Color 02 'tput setaf 1'"
|
||||
#green
|
||||
echo -e "${DEMO_COLOR_03} ███ *** AaBbCs --- ███ ${RS} ---> Color 03 'tput setaf 2'"
|
||||
#yellow
|
||||
echo -e "${DEMO_COLOR_04} ███ *** AaBbCs --- ███ ${RS} ---> Color 04 'tput setaf 3'"
|
||||
#blue
|
||||
echo -e "${DEMO_COLOR_05} ███ *** AaBbCs --- ███ ${RS} ---> Color 05 'tput setaf 4'"
|
||||
#purple
|
||||
echo -e "${DEMO_COLOR_06} ███ *** AaBbCs --- ███ ${RS} ---> Color 06 'tput setaf 5'"
|
||||
#cyan
|
||||
echo -e "${DEMO_COLOR_07} ███ *** AaBbCs --- ███ ${RS} ---> Color 07 'tput setaf 6'"
|
||||
#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 ""
|
||||
printf '%b\n' "${DEMO_COLOR_01} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 01 'tput setaf 0'" # black
|
||||
printf '%b\n' "${DEMO_COLOR_02} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 02 'tput setaf 1'" # red
|
||||
printf '%b\n' "${DEMO_COLOR_03} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 03 'tput setaf 2'" # green
|
||||
printf '%b\n' "${DEMO_COLOR_04} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 04 'tput setaf 3'" # yellow
|
||||
printf '%b\n' "${DEMO_COLOR_05} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 05 'tput setaf 4'" # blue
|
||||
printf '%b\n' "${DEMO_COLOR_06} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 06 'tput setaf 5'" # pruple
|
||||
printf '%b\n' "${DEMO_COLOR_07} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 07 'tput setaf 6'" # cyan
|
||||
printf '%b\n\n' "${DEMO_COLOR_08} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 08 'tput setaf 7'" # white
|
||||
printf '%b\n' "${DEMO_COLOR_09} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 09 'tput setaf 8'" # bold black
|
||||
printf '%b\n' "${DEMO_COLOR_10} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 10 'tput setaf 9'" # bold red
|
||||
printf '%b\n' "${DEMO_COLOR_11} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 11 'tput setaf 10'" # bold green
|
||||
printf '%b\n' "${DEMO_COLOR_12} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 12 'tput setaf 11'" # bold yellow
|
||||
printf '%b\n' "${DEMO_COLOR_13} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 13 'tput setaf 12'" # bold blue
|
||||
printf '%b\n' "${DEMO_COLOR_14} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 14 'tput setaf 13'" # bold purple
|
||||
printf '%b\n' "${DEMO_COLOR_15} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 15 'tput setaf 14'" # bold cyan
|
||||
printf '%b\n\n' "${DEMO_COLOR_16} ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 16 'tput setaf 15'" # bold white
|
||||
}
|
||||
|
||||
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::stop > /dev/null && bar::stop || :
|
||||
|
||||
unset GOGH_DRY_RUN
|
88
test/test.sh
88
test/test.sh
@ -1,71 +1,31 @@
|
||||
#!/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 () {
|
||||
# echo ""
|
||||
#black
|
||||
echo -e "\e[0;30m ███ *** AaBbCs --- ███ \\e[0m ---> Color 01 0;30m"
|
||||
#red
|
||||
echo -e "\e[0;31m ███ *** AaBbCs --- ███ \\e[0m ---> Color 02 0;31m"
|
||||
#green
|
||||
echo -e "\e[0;32m ███ *** AaBbCs --- ███ \\e[0m ---> Color 03 0;32m"
|
||||
#yellow
|
||||
echo -e "\e[0;33m ███ *** AaBbCs --- ███ \\e[0m ---> Color 04 0;33m"
|
||||
#blue
|
||||
echo -e "\e[0;34m ███ *** AaBbCs --- ███ \\e[0m ---> Color 05 0;34m"
|
||||
#purple
|
||||
echo -e "\e[0;35m ███ *** AaBbCs --- ███ \\e[0m ---> Color 06 0;35m"
|
||||
#cyan
|
||||
echo -e "\e[0;36m ███ *** AaBbCs --- ███ \\e[0m ---> Color 07 0;36m"
|
||||
#white
|
||||
echo -e "\e[0;37m ███ *** AaBbCs --- ███ \\e[0m ---> Color 08 0;37m"
|
||||
echo ""
|
||||
#black
|
||||
echo -e "\e[1;30m ███ *** AaBbCs --- ███ \\e[0m ---> Color 09 1;30m"
|
||||
#red
|
||||
echo -e "\e[1;31m ███ *** AaBbCs --- ███ \\e[0m ---> Color 10 1;31m"
|
||||
#green
|
||||
echo -e "\e[1;32m ███ *** AaBbCs --- ███ \\e[0m ---> Color 11 1;32m"
|
||||
#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"
|
||||
printf '%s\n' "$(tput setaf 0 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 01 'tput setaf 0'" # black
|
||||
printf '%s\n' "$(tput setaf 1 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 02 'tput setaf 1'" # red
|
||||
printf '%s\n' "$(tput setaf 2 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 03 'tput setaf 2'" # green
|
||||
printf '%s\n' "$(tput setaf 3 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 04 'tput setaf 3'" # yellow
|
||||
printf '%s\n' "$(tput setaf 4 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 05 'tput setaf 4'" # blue
|
||||
printf '%s\n' "$(tput setaf 5 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 06 'tput setaf 5'" # pruple
|
||||
printf '%s\n' "$(tput setaf 6 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 07 'tput setaf 6'" # cyan
|
||||
printf '%s\n\n' "$(tput setaf 7 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 08 'tput setaf 7'" # white
|
||||
printf '%s\n' "$(tput setaf 8 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 09 'tput setaf 8'" # bold black
|
||||
printf '%s\n' "$(tput setaf 9 ) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 10 'tput setaf 9'" # bold red
|
||||
printf '%s\n' "$(tput setaf 10) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 11 'tput setaf 10'" # bold green
|
||||
printf '%s\n' "$(tput setaf 11) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 12 'tput setaf 11'" # bold yellow
|
||||
printf '%s\n' "$(tput setaf 12) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 13 'tput setaf 12'" # bold blue
|
||||
printf '%s\n' "$(tput setaf 13) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 14 'tput setaf 13'" # bold purple
|
||||
printf '%s\n' "$(tput setaf 14) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 15 'tput setaf 14'" # bold cyan
|
||||
printf '%s\n\n' "$(tput setaf 15) ███ *** AaBbCs --- ███ $(tput sgr0) ---> Color 16 'tput setaf 15'" # bold white
|
||||
|
||||
local color_str
|
||||
for c in {0..15}; do
|
||||
color_dot_str+="$(tput setaf $c)•$(tput sgr0)"
|
||||
[[ $c == 7 ]] && color_dot_str+=" "
|
||||
done
|
||||
printf '%s\n' "$color_str"
|
||||
unset color_str
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user