https://github.com/mattn/Go-colorable
https://github.com/mattn/Go-colorable
color go golang windows
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mattn/Go-colorable
- Owner: mattn
- License: mit
- Created: 2014-07-30T02:38:06.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2024-01-17T17:59:04.000Z (over 1 year ago)
- Last Synced: 2024-10-29T15:12:00.662Z (8 months ago)
- Topics: color, go, golang, windows
- Language: Go
- Homepage: http://godoc.org/github.com/mattn/go-colorable
- Size: 154 KB
- Stars: 766
- Watchers: 19
- Forks: 93
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# go-colorable
[](https://github.com/mattn/go-colorable/actions?query=workflow%3Atest)
[](https://codecov.io/gh/mattn/go-colorable)
[](http://godoc.org/github.com/mattn/go-colorable)
[](https://goreportcard.com/report/mattn/go-colorable)Colorable writer for windows.
For example, most of logger packages doesn't show colors on windows. (I know we can do it with ansicon. But I don't want.)
This package is possible to handle escape sequence for ansi color on windows.## Too Bad!

## So Good!

## Usage
```go
logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true})
logrus.SetOutput(colorable.NewColorableStdout())logrus.Info("succeeded")
logrus.Warn("not correct")
logrus.Error("something error")
logrus.Fatal("panic")
```You can compile above code on non-windows OSs.
## Installation
```
$ go get github.com/mattn/go-colorable
```# License
MIT
# Author
Yasuhiro Matsumoto (a.k.a mattn)