• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..19-Feb-2022-

LICENSEH A D19-Feb-20221.1 KiB2217

README.mdH A D19-Feb-2022840 4426

colorable_others.goH A D19-Feb-2022323 2517

colorable_windows.goH A D19-Feb-202217.4 KiB784751

noncolorable.goH A D19-Feb-2022978 5852

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