summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Nguyen <benjamin.van.nguyen@gmail.com>2023-06-25 23:35:38 -0700
committerBenjamin Nguyen <benjamin.van.nguyen@gmail.com>2023-06-25 23:35:38 -0700
commit907a6e31d64d2010d987cd8f743e6add047f8592 (patch)
treed1d13316a1ee4f55c2a1440d5da52ad0968f1850
parent910d9d3cbbac1d2dbe596c647b16e1f658ac3c9f (diff)
no color support
-rw-r--r--README.md2
-rw-r--r--src/context/mod.rs4
2 files changed, 4 insertions, 2 deletions
diff --git a/README.md b/README.md
index 3ac15fd..4493dc2 100644
--- a/README.md
+++ b/README.md
@@ -773,6 +773,8 @@ If, however, the default behavior doesn't suit your needs you have control over
- force: Turn on colorization always
```
+`erdtree` also supports [NO_COLOR](https://no-color.org/).
+
<p align="center">
<img src="https://github.com/solidiquis/erdtree/blob/master/assets/colorization.png?raw=true" alt="failed to load picture" />
</p>
diff --git a/src/context/mod.rs b/src/context/mod.rs
index 9d331d7..c7e060a 100644
--- a/src/context/mod.rs
+++ b/src/context/mod.rs
@@ -327,8 +327,8 @@ impl Context {
///
/// If Coloring is Force then this will always evaluate to `false`.
pub fn no_color(&self) -> bool {
- if color::NO_COLOR.get().is_some_and(Option::is_some) {
- return true;
+ if let Some(Some(var)) = color::NO_COLOR.get() {
+ return !var.is_empty();
}
match self.color {