Simple golang command line colorize api for outputs highlight.
go get -u github.com/dolab/colorize
- Standard
import "github.com/dolab/colorize"
func main() {
brush := colorize.New("yellow+bBuih:black+h")
brush.Paint("Hello, colorize!")
}
- Customize
import "github.com/dolab/colorize"
func main() {
brush := colorize.New("yellow+bBuih:black+h")
// gain colors
colorDraw, colorClean := brush.Colour()
// custom output
buf := bytes.NewBufferString(colorDraw)
buf.WriteString("Hello, colorize!")
buf.WriteString(colorClean)
buf.WriteTo(os.Stdout)
}
foreground_color
+color_attributes
:background_color
+color_attributes
- ColorRed
- ColorGreen
- ColorYellow
- ColorBlue
- ColorMagenta
- ColorCyan
- ColorWhite
- ColorGray
- ColorBlack
- b = bold foreground
- B = blink foreground
- u = underline foreground
- i = inverse
- h = high intensity (bright) foreground, background
see go-colorable
MIT
Spring MC