LogColorDisabled reports whether colorized log output should be disabled. It follows the same approach as the supports-color/chalk family: honor the NO_COLOR / FORCE_COLOR conventions, then enable color on an interactive terminal or in a CI system known to render ANSI escape codes.
()
| 45 | // NO_COLOR / FORCE_COLOR conventions, then enable color on an interactive |
| 46 | // terminal or in a CI system known to render ANSI escape codes. |
| 47 | func LogColorDisabled() bool { |
| 48 | return !colorSupported(os.LookupEnv, term.IsTerminal(int(os.Stderr.Fd()))) |
| 49 | } |
| 50 | |
| 51 | // colorSupported decides whether ANSI color should be emitted, given a way to |
| 52 | // look up environment variables and whether stderr is an interactive terminal. |
no test coverage detected