From 9bff1cdad5ecb0195cbbf9a61ac17659ba76f387 Mon Sep 17 00:00:00 2001 From: urbanware-org Date: Thu, 28 Jan 2021 21:55:36 +0100 Subject: [PATCH] Replace color code with corresponding variable --- core/common.sh | 2 +- core/output.sh | 8 ++++---- snippets/confetti.sh | 8 ++++---- testrun/testrun.sh | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/core/common.sh b/core/common.sh index 4735bc7..f28c2b5 100755 --- a/core/common.sh +++ b/core/common.sh @@ -349,7 +349,7 @@ print_arg_list() { echo -e "$char_line_double\c" done - echo -e "\e[0m\n" + echo -e "${cl_n}\n" echo -e "With the given information, the command line would look like" \ "this (without" echo -e "'${cl_lc}--dialog${cl_n}' or '${cl_lc}--interactive${cl_n}'" \ diff --git a/core/output.sh b/core/output.sh index 194a618..e3adb0a 100755 --- a/core/output.sh +++ b/core/output.sh @@ -470,16 +470,16 @@ print_output_line() { line=$(sed -e "s/^$color_code//g" <<< "$output") output=$(sed -e "s/\\\e\[.*//g" <<< "$line") random_colors "$output" - elif [ "$color_code" = "\e[0m" ] && [ $highlight_all -eq 0 ]; then + elif [ "$color_code" = "${cl_n}" ] && [ $highlight_all -eq 0 ]; then if [ $leading_line_char -eq 1 ]; then - echo -e "\e[0m${char_line_leading} $line\e[0m" + echo -e "${cl_n}${char_line_leading} $line${cl_n}" else - echo -e "\e[0m${line}\e[0m" + echo -e "${cl_n}${line}${cl_n}" fi else if [ $leading_line_char -eq 1 ]; then if [ $leading_line_char_colored -eq 1 ]; then - echo -e "${color_code}$char_line_leading $output" + echo -e "${color_code}$char_line_leading $output" else echo -e "$char_line_leading $output" fi diff --git a/snippets/confetti.sh b/snippets/confetti.sh index 029dd2f..3d24117 100755 --- a/snippets/confetti.sh +++ b/snippets/confetti.sh @@ -13,15 +13,15 @@ confetti() { if [ $highlight_random -eq 1 ]; then color_highlight=$(shuf -i 0-1 -n 1) if [ $color_highlight -eq 1 ]; then - color_char="\e[48;5;${color_confetti}m${char}\e[0m" + color_char="\e[48;5;${color_confetti}m${char}${cl_n}" else - color_char="\e[38;5;${color_confetti}m${char}\e[0m" + color_char="\e[38;5;${color_confetti}m${char}${cl_n}" fi else if [ $highlight -eq 1 ]; then - color_char="\e[48;5;${color_confetti}m${char}\e[0m" + color_char="\e[48;5;${color_confetti}m${char}${cl_n}" else - color_char="\e[38;5;${color_confetti}m${char}\e[0m" + color_char="\e[38;5;${color_confetti}m${char}${cl_n}" fi fi line_output="${line_output}${color_char}" diff --git a/testrun/testrun.sh b/testrun/testrun.sh index 2dba336..c7c4a50 100755 --- a/testrun/testrun.sh +++ b/testrun/testrun.sh @@ -116,15 +116,15 @@ echo \ ' | |/ _ \/ __| __| '\''__| | | | '\''_ \ / __| __/ _'\'' | __| | | / __|' echo ' | | __/\__ \ |_| | | |_| | | | | \__ \ || (_| | |_| |_| \__ \' echo ' |_|\___||___/\__|_| \__,_|_| |_| |___/\__\__,_|\__|\__,_|___/' -echo -e "\e[0m" +echo -e "${cl_n}" echo " Testrun finished." if [ $salomon_status -eq 0 ]; then - echo -e " Overall status: \e[92mSuccessfully passed\e[0m" + echo -e " Overall status: \e[92mSuccessfully passed${cl_n}" else - echo -e " Overall status: \e[91mFailed\e[0m (at least one test)" + echo -e " Overall status: \e[91mFailed${cl_n} (at least one test)" fi echo -echo -e "For details see the file \e[96m$salomon_testrun_log\e[0m." +echo -e "For details see the file \e[96m$salomon_testrun_log${cl_n}." echo exit $salomon_status