From ec65beea2e911fbb2dde416d83bbffe43f959a55 Mon Sep 17 00:00:00 2001 From: Phil Crockett Date: Sat, 18 Jan 2025 20:32:14 +0100 Subject: [PATCH] fix(colors): only print colors if NO_COLOR is non-empty string from : > Command-line software which adds ANSI color to its output by default > should check for a NO_COLOR environment variable that, when present > and **not an empty string** (regardless of its value), prevents the > addition of ANSI color. (emphasis mine) if NO_COLOR is an empty string, color should still be printed. --- lib/bashly/libraries/colors/colors.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bashly/libraries/colors/colors.sh b/lib/bashly/libraries/colors/colors.sh index 7458e2d9..b98fbd7d 100644 --- a/lib/bashly/libraries/colors/colors.sh +++ b/lib/bashly/libraries/colors/colors.sh @@ -13,7 +13,7 @@ print_in_color() { local color="$1" shift - if [[ -z ${NO_COLOR+x} ]]; then + if [[ "${NO_COLOR:-}" == "" ]]; then printf "$color%b\e[0m\n" "$*" else printf "%b\n" "$*"