Skip to content

Commit ec65bee

Browse files
committed
fix(colors): only print colors if NO_COLOR is non-empty string
from <https://no-color.org/>: > 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.
1 parent 4fa73db commit ec65bee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/bashly/libraries/colors/colors.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
print_in_color() {
1414
local color="$1"
1515
shift
16-
if [[ -z ${NO_COLOR+x} ]]; then
16+
if [[ "${NO_COLOR:-}" == "" ]]; then
1717
printf "$color%b\e[0m\n" "$*"
1818
else
1919
printf "%b\n" "$*"

0 commit comments

Comments
 (0)