Skip to content

Commit

Permalink
[Refactor] nvm_has_colors: also check the env var
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jul 29, 2024
1 parent 87a7097 commit ff1257e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ nvm_has_colors() {
if nvm_has tput; then
NVM_NUM_COLORS="$(tput -T "${TERM:-vt100}" colors)"
fi
[ "${NVM_NUM_COLORS:--1}" -ge 8 ]
[ "${NVM_NUM_COLORS:--1}" -ge 8 ] && [ "${NVM_NO_COLORS-}" != '--no-colors' ]
}

nvm_curl_libz_support() {
Expand Down Expand Up @@ -1094,7 +1094,7 @@ nvm_print_formatted_alias() {
fi
local ARROW
ARROW='->'
if [ -z "${NVM_NO_COLORS}" ] && nvm_has_colors; then
if nvm_has_colors; then
ARROW='\033[0;90m->\033[0m'
if [ "_${DEFAULT}" = '_true' ]; then
NEWLINE=" \033[${DEFAULT_COLOR}(default)\033[0m\n"
Expand Down Expand Up @@ -1832,7 +1832,7 @@ nvm_print_versions() {
DEFAULT_COLOR=$(nvm_get_colors 5)
LTS_COLOR=$(nvm_get_colors 6)

if [ -z "${NVM_NO_COLORS-}" ] && nvm_has_colors; then
if nvm_has_colors; then
NVM_HAS_COLORS=1
fi

Expand Down

0 comments on commit ff1257e

Please sign in to comment.