Skip to content

Commit 721440b

Browse files
authored
Merge pull request #81 from AnInternetTroll/master
Add NO_COLOR env support
2 parents d30c3dd + 812cf0b commit 721440b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/output.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
use std::fmt;
44
use std::time::Duration;
5+
use std::env;
56

67
use dns::{Response, Query, Answer, QClass, ErrorCode, WireError, MandatedLength};
78
use dns::record::{Record, RecordType, UnknownQtype, OPT};
@@ -55,7 +56,7 @@ impl UseColours {
5556
/// overridden the colour setting, and if not, whether output is to a
5657
/// terminal.
5758
pub fn should_use_colours(self) -> bool {
58-
self == Self::Always || (atty::is(atty::Stream::Stdout) && self != Self::Never)
59+
self == Self::Always || (atty::is(atty::Stream::Stdout) && env::var("NO_COLOR").is_err() && self != Self::Never)
5960
}
6061

6162
/// Creates a palette of colours depending on the user’s wishes or whether

0 commit comments

Comments
 (0)