You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 840 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # go-colorable
  2. Colorable writer for windows.
  3. 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.)
  4. This package is possible to handle escape sequence for ansi color on windows.
  5. ## Too Bad!
  6. ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/bad.png)
  7. ## So Good!
  8. ![](https://raw.githubusercontent.com/mattn/go-colorable/gh-pages/good.png)
  9. ## Usage
  10. ```go
  11. logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true})
  12. logrus.SetOutput(colorable.NewColorableStdout())
  13. logrus.Info("succeeded")
  14. logrus.Warn("not correct")
  15. logrus.Error("something error")
  16. logrus.Fatal("panic")
  17. ```
  18. You can compile above code on non-windows OSs.
  19. ## Installation
  20. ```
  21. $ go get github.com/mattn/go-colorable
  22. ```
  23. # License
  24. MIT
  25. # Author
  26. Yasuhiro Matsumoto (a.k.a mattn)