From c606382a6291bcac3514155beed1da05763f2c1c Mon Sep 17 00:00:00 2001 From: Ahmet Alp Balkan Date: Sun, 10 Jun 2018 14:15:44 -0700 Subject: [PATCH] Respect $NO_COLOR Fixes #54. Signed-off-by: Ahmet Alp Balkan --- kubectx | 2 +- kubens | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/kubectx b/kubectx index f625d75..c80a763 100755 --- a/kubectx +++ b/kubectx @@ -63,7 +63,7 @@ list_contexts() { cur_ctx_bg=${KUBECTX_CURRENT_BGCOLOR:-$darkbg} for c in $(get_contexts); do - if [[ -t 1 && "${c}" = "${cur}" ]]; then + if [[ -t 1 && -z "${NO_COLOR:-}" && "${c}" = "${cur}" ]]; then echo "${cur_ctx_bg}${cur_ctx_fg}${c}${normal}" else echo "${c}" diff --git a/kubens b/kubens index 628181b..6145e94 100755 --- a/kubens +++ b/kubens @@ -117,7 +117,7 @@ list_namespaces() { cur="$(current_namespace)" ns_list=$(get_namespaces) for c in $ns_list; do - if [[ -t 1 && "${c}" = "${cur}" ]]; then + if [[ -t 1 && -z "${NO_COLOR:-}" && "${c}" = "${cur}" ]]; then echo "${cur_ctx_bg}${cur_ctx_fg}${c}${normal}" else echo "${c}"