Check for tty before coloring

This accounts for redirecting (for example for log files). So the string only gets colored if the user is going to see it, otherwise we don't color to prevent cruft in log files.