From 8f0ac7c8abb4e0830d6cf72bbbd5f38c44b4266d Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Mon, 29 Jan 2018 15:42:38 +0100 Subject: support $NO_COLOR http://no-color.org/ --- lr.1 | 3 +++ lr.c | 2 ++ 2 files changed, 5 insertions(+) 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) { -- cgit 1.4.1