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.

colorable_others.go 645B

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