diff --git a/CHANGELOG.md b/CHANGELOG.md index c4b2b18..bba5bf4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## 0.2.4 (unreleased) +- Respect the `NO_COLOR` environment variable and disable colour when it is set + and nonempty (when the default `--color=auto` is used). For more info see: + https://no-color.org + ## 0.2.3 (2023-05-22) - Fix compatibility with nix-2.3 where `nix --extra-experimental-features` isn't diff --git a/src/nvd b/src/nvd index 916a96e..9a07fd2 100755 --- a/src/nvd +++ b/src/nvd @@ -764,7 +764,9 @@ def main(): args = parse_args() action = args.action NIX_BIN_DIR = args.nix_bin_dir or None - USE_COLOUR = args.color == "always" or (args.color == "auto" and sys.stdout.isatty()) + USE_COLOUR = \ + args.color == "always" \ + or (args.color == "auto" and sys.stdout.isatty() and not os.getenv('NO_COLOR')) del args.action del args.nix_bin_dir del args.color