A tiny cross-platform terminal color library that supports enabling and disabling colors.
Tested on macOS and (occasionally) on Ubuntu 20 and Windows 10.
Basically complete! gocolor works for my simple use cases. I'm watching issues; please open one for any questions and especially BEFORE submitting a Pull request.
color, err := gocolor.Prepare(true)
if err != nil {
panic(err)
}
fmt.Println(
color.Add(color.FgRed, "FgRed"),
color.Add(color.FgCyanBright+color.Negative, "FgCyanBright+Negative"),
)See tests for inspiration.
I use mattn/go-isatty to test my programs before enabling this.
See Go Project Notes for notes on development tooling.
- https://github.com/TwiN/go-color (API inspiration)
- https://github.com/bbkane/go-color (my - now deprecated - fork of TwiN/go-color)
- https://github.com/fatih/color (color naming)
- https://github.com/jedib0t/go-pretty (Windows code)
