Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 15-Sep-2021 | - | ||||
LICENSE | H A D | 15-Sep-2021 | 1.1 KiB | 22 | 17 | |
README.md | H A D | 15-Sep-2021 | 840 | 44 | 26 | |
colorable_others.go | H A D | 15-Sep-2021 | 323 | 25 | 17 | |
colorable_windows.go | H A D | 15-Sep-2021 | 17.4 KiB | 784 | 751 | |
noncolorable.go | H A D | 15-Sep-2021 | 978 | 58 | 52 |
README.md
1# go-colorable 2 3Colorable writer for windows. 4 5For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.) 6This package is possible to handle escape sequence for ansi color on windows. 7 8## Too Bad! 9 10![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png) 11 12 13## So Good! 14 15![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png) 16 17## Usage 18 19```go 20logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true}) 21logrus.SetOutput(colorable.NewColorableStdout()) 22 23logrus.Info("succeeded") 24logrus.Warn("not correct") 25logrus.Error("something error") 26logrus.Fatal("panic") 27``` 28 29You can compile above code on non-windows OSs. 30 31## Installation 32 33``` 34$ go get github.com/mattn/go-colorable 35``` 36 37# License 38 39MIT 40 41# Author 42 43Yasuhiro Matsumoto (a.k.a mattn) 44