Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | 03-May-2022 | - | ||||
.github/ | H | 03-Oct-2020 | - | 13 | 11 | |
_example/ | H | 03-Oct-2020 | - | 50 | 37 | |
cmd/colorable/ | H | 03-Oct-2020 | - | 13 | 9 | |
.travis.yml | H A D | 03-Oct-2020 | 175 | 16 | 11 | |
LICENSE | H A D | 03-Oct-2020 | 1.1 KiB | 22 | 17 | |
README.md | H A D | 03-Oct-2020 | 1.3 KiB | 49 | 30 | |
colorable_appengine.go | H A D | 03-Oct-2020 | 785 | 38 | 24 | |
colorable_others.go | H A D | 03-Oct-2020 | 805 | 39 | 24 | |
colorable_test.go | H A D | 03-Oct-2020 | 2.1 KiB | 99 | 83 | |
colorable_windows.go | H A D | 03-Oct-2020 | 24.5 KiB | 1,044 | 987 | |
go.mod | H A D | 03-Oct-2020 | 160 | 9 | 6 | |
go.sum | H A D | 03-Oct-2020 | 487 | 6 | 5 | |
go.test.sh | H A D | 03-Oct-2020 | 273 | 13 | 9 | |
noncolorable.go | H A D | 03-Oct-2020 | 951 | 56 | 46 |
README.md
1# go-colorable 2 3[![Build Status](https://travis-ci.org/mattn/go-colorable.svg?branch=master)](https://travis-ci.org/mattn/go-colorable) 4[![Codecov](https://codecov.io/gh/mattn/go-colorable/branch/master/graph/badge.svg)](https://codecov.io/gh/mattn/go-colorable) 5[![GoDoc](https://godoc.org/github.com/mattn/go-colorable?status.svg)](http://godoc.org/github.com/mattn/go-colorable) 6[![Go Report Card](https://goreportcard.com/badge/mattn/go-colorable)](https://goreportcard.com/report/mattn/go-colorable) 7 8Colorable writer for windows. 9 10For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.) 11This package is possible to handle escape sequence for ansi color on windows. 12 13## Too Bad! 14 15![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png) 16 17 18## So Good! 19 20![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png) 21 22## Usage 23 24```go 25logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true}) 26logrus.SetOutput(colorable.NewColorableStdout()) 27 28logrus.Info("succeeded") 29logrus.Warn("not correct") 30logrus.Error("something error") 31logrus.Fatal("panic") 32``` 33 34You can compile above code on non-windows OSs. 35 36## Installation 37 38``` 39$ go get github.com/mattn/go-colorable 40``` 41 42# License 43 44MIT 45 46# Author 47 48Yasuhiro Matsumoto (a.k.a mattn) 49