()
| 18 | * both honor NO_COLOR, --no-color/--color, FORCE_COLOR, TTY, and CI. |
| 19 | */ |
| 20 | export function ansiColorsEnabled(): boolean { |
| 21 | if (process.argv.includes('--no-color')) return false; |
| 22 | if (process.argv.includes('--color')) return true; |
| 23 | |
| 24 | const noColor = process.env.NO_COLOR; |
| 25 | if (noColor !== undefined && noColor !== '') return false; |
| 26 | |
| 27 | const forceColor = process.env.FORCE_COLOR; |
| 28 | if (forceColor !== undefined && forceColor !== '') { |
| 29 | return forceColor !== '0' && forceColor.toLowerCase() !== 'false'; |
| 30 | } |
| 31 | |
| 32 | if (process.stdout.isTTY === true && process.env.TERM !== 'dumb') return true; |
| 33 | |
| 34 | const ci = process.env.CI; |
| 35 | if (ci !== undefined && ci !== '') return true; |
| 36 | |
| 37 | return false; |
| 38 | } |
no outgoing calls
no test coverage detected