(w io.Writer)
| 35 | } |
| 36 | |
| 37 | func detectColor(w io.Writer) bool { |
| 38 | if os.Getenv("NO_COLOR") != "" { |
| 39 | return false |
| 40 | } |
| 41 | if term := os.Getenv("TERM"); term == "dumb" { |
| 42 | return false |
| 43 | } |
| 44 | file, ok := w.(*os.File) |
| 45 | if !ok { |
| 46 | return false |
| 47 | } |
| 48 | return isatty.IsTerminal(file.Fd()) || isatty.IsCygwinTerminal(file.Fd()) |
| 49 | } |
| 50 | |
| 51 | func (p *Printer) sprint(c *color.Color, msg string) string { |
| 52 | if !p.Color { |