fatih / color

Color package for Go (golang)
https://pkg.go.dev/github.com/fatih/color
MIT License
7.36k stars 619 forks source link

color: only show color in stdout #19

Closed zddhub closed 9 years ago

zddhub commented 9 years ago

I find a solution to close https://github.com/fatih/color/issues/18. Do you agree?

fatih commented 9 years ago

That would work, tough please use https://github.com/mattn/go-isatty because it has Windows support too:

var NoColor = !isatty.IsTerminal(os.Stdout.Fd())

Also please change the doc to point that it changes dynamically:

// NoColor defines if the output is colorized or not. It's dynamically set to
// false or true based on the stdout's file descriptor referring to a terminal
// or not. This is a global option and affects all colors. For more control
// over each color block use the methods DisableColor() individually.
zddhub commented 9 years ago

Done

fatih commented 9 years ago

Thanks @zddhub