colorable_others.go 606 B

12345678910111213141516171819202122232425262728
  1. // +build !windows
  2. // +build !appengine
  3. package colorable
  4. import (
  5. "io"
  6. "os"
  7. )
  8. // NewColorable return new instance of Writer which handle escape sequence.
  9. func NewColorable(file *os.File) io.Writer {
  10. if file == nil {
  11. panic("nil passed instead of *os.File to NewColorable()")
  12. }
  13. return file
  14. }
  15. // NewColorableStdout return new instance of Writer which handle escape sequence for stdout.
  16. func NewColorableStdout() io.Writer {
  17. return os.Stdout
  18. }
  19. // NewColorableStderr return new instance of Writer which handle escape sequence for stderr.
  20. func NewColorableStderr() io.Writer {
  21. return os.Stderr
  22. }