fatih / color

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

Support CI clis #80

Closed rakyll closed 6 years ago

rakyll commented 6 years ago

Colored output seems to be disabled because color package is not detecting the CI system CLIs. It looks like many is setting a CI env variable we can look for and enable colors on the known providers. Also see the reference at https://github.com/chalk/supports-color/blob/master/index.js#L66.

broady commented 6 years ago

Or provide some other env variable to force color output?

fatih commented 6 years ago

I can add it, need to be sure it's worth adding it (probably is for many).

As @broady said, in gotest main function, you could do it with the following (as an example just for travis):

if os.Getenv("CI") == "Travis" {
    color.NoColor = false
}
broady commented 6 years ago

^ this looks like a better patch than doing it in color.

rakyll commented 6 years ago

Happy to apply the patch instead.

fatih commented 6 years ago

Nice. Closing this. I believe it's better not add anything necessary.