Skip to content

Commit c43753c

Browse files
committed
Support NO_COLOR environment variable, as per https://no-color.org
1 parent e4571a5 commit c43753c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/misc.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2154,7 +2154,12 @@ int terminal_supports_color(void)
21542154
#ifndef _WIN32
21552155
char *s;
21562156

2157-
/* Yeah we check all of stdin, stdout, stderr, because
2157+
/* Support NO_COLOR as per https://no-color.org */
2158+
s = getenv("NO_COLOR");
2159+
if (s != NULL && s[0] != '\0')
2160+
return 0;
2161+
2162+
/* Yeah we check all of stdin, stdout, stderr, because one
21582163
* or more may be redirected (bin/unrealircd >log 2>&1),
21592164
* and then we want to say no to color support.
21602165
*/

0 commit comments

Comments
 (0)