GoLang colorized output library for Mac & Linux Shell, 中文版说明
- Make sure your've read GoLang Official File Structure
- Make sure you've set a correct GOPATH
$ go get github.com/bclicn/color- In your script,
import "github.com/bclicn/color"then callcolor.Test() - Use
fmt.Println("Hello" + color.Red("World"))to assemble a colorized output - API examples available in
color-test.go
- Download
color.go - Modify its
package colortopackage main - Put your script under the same directory and write
fmt.Println(Red("I'm red !!!")) - Run
go run color.go yourScript.go - Or build by
go build color.go yourScript.go
package main
import (
"fmt"
"github.com/bclicn/color"
)
func main(){
fmt.Println(color.Red("Red output"))
color.Test()
}
bcli, 2018-7-11
