aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar lvgx <l@vgx.fr>2020-04-13 18:51:56 +0200
committerGravatar GitHub <noreply@github.com>2020-04-13 22:21:56 +0530
commita6cef2504cf215e9c969cf42b71b54054e353031 (patch)
tree3c436fb6410bba7b4ef830c815daf5af7c584cf7
parentcd1c458c96cdf5674c2fb793a16e57435ffe05b7 (diff)
downloadnnn-a6cef2504cf215e9c969cf42b71b54054e353031.tar.gz
Make NNN_COLORS override NO_COLORS (#515)
-rw-r--r--nnn.12
-rw-r--r--src/nnn.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/nnn.1 b/nnn.1
index 6b5ff0a..c424b46 100644
--- a/nnn.1
+++ b/nnn.1
@@ -417,7 +417,7 @@ separated by \fI;\fR:
\fBnnn:\fR this is a special variable set to the hovered entry before executing
a command from the command prompt or spawning a shell.
.Pp
-\fBNO_COLOR:\fR if defined, disable ANSI color output.
+\fBNO_COLOR:\fR disable ANSI color output (overridden by \fBNNN_COLORS\fR).
.Sh KNOWN ISSUES
.Nm
may not handle keypresses correctly when used with tmux (see issue #104 for
diff --git a/src/nnn.c b/src/nnn.c
index 3233acb..d8a2aa6 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1494,9 +1494,13 @@ static bool initcurses(void *oldmask)
#endif
curs_set(FALSE); /* Hide cursor */
- if (!getenv("NO_COLOR")) {
+ char *colors = getenv(env_cfg[NNN_COLORS]);
+
+ if (colors || !getenv("NO_COLOR")) {
short i;
- char *colors = xgetenv(env_cfg[NNN_COLORS], "4444");
+
+ if (!colors)
+ colors = "4444";
start_color();
use_default_colors();