One more Go library for using colors in the terminal console. The most important features are:
FORCE_COLOR
, NO_COLOR
and TERM
variables out of the boxgolang.org/x
)package main
import (
"fmt"
"gh.tarampamp.am/colors"
)
func main() {
fmt.Println((colors.FgGreen | colors.Bold).Wrap("green color + bold text"))
var bg = colors.BgRed
fmt.Printf("%s red background %s\n", bg.Start(), bg.Reset())
colors.Enabled(false) // disable colors
colors.Enabled(true) // enable colors
}
For more examples see examples directory.