Return whether ANSI colors should be emitted.
()
| 22 | |
| 23 | |
| 24 | def _use_color() -> bool: |
| 25 | """Return whether ANSI colors should be emitted.""" |
| 26 | return "NO_COLOR" not in os.environ and os.environ.get("TERM") != "dumb" and sys.stdout.isatty() |
| 27 | |
| 28 | |
| 29 | def _color(code: str, text: str, enabled: bool) -> str: |