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 color
topackage 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