about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2018-01-29 15:42:38 +0100
committerLeah Neukirchen <leah@vuxu.org>2018-01-29 15:42:38 +0100
commit8f0ac7c8abb4e0830d6cf72bbbd5f38c44b4266d (patch)
treeaf23b7802734655293005086e3a4849e69cc9918
parenta5dcf178247b7f446ad27ad12f03f80745d432d7 (diff)
downloadlr-8f0ac7c8abb4e0830d6cf72bbbd5f38c44b4266d.tar.gz
lr-8f0ac7c8abb4e0830d6cf72bbbd5f38c44b4266d.tar.xz
lr-8f0ac7c8abb4e0830d6cf72bbbd5f38c44b4266d.zip
support $NO_COLOR
http://no-color.org/
-rw-r--r--lr.13
-rw-r--r--lr.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/lr.1 b/lr.1
index a673036..920b2fd 100644
--- a/lr.1
+++ b/lr.1
@@ -115,6 +115,9 @@ Don't enter directories.
 .It Fl G
 Colorize output to TTY.
 Use twice to force colorized output.
+If the environment variable
+.Ev NO_COLOR
+is set, colors are never used.
 .It Fl X
 Output OSC 8 hyperlinks to TTY.
 Use twice to force hyperlinks.
diff --git a/lr.c b/lr.c
index 06b70ca..774b1d2 100644
--- a/lr.c
+++ b/lr.c
@@ -2468,6 +2468,8 @@ main(int argc, char *argv[])
 		if (Xflag == 1)
 			Xflag = 0;
 	}
+	if (getenv("NO_COLOR"))
+		Gflag = 0;
 
 	analyze_format();
 	if (Uflag) {