Print colored output only to a tty

Color output only if standard and error output are ttys.
Merge pull request #1452 from dohse/color-only-tty-output

Print colored output only to a tty