Remove color from output when outputting to a pipe

Remove color output from info, warn, and error messages when the
output is to a pipe.

BUG=none
TEST=`./package_dependency_list.sh --board=beaglebone gflags` output
  is in color
TEST=`./package_dependency_list.sh --board=beaglebone gflags | cat`
  output is not in color
TEST=`cbuildbot --remote -g 184938 chromiumos-sdk x86-generic-paladin\
  amd64-generic-paladin daisy-paladin` all pass

Change-Id: Id54e2862d075874d8929679962b8b70f21857b06
Reviewed-on: https://chromium-review.googlesource.com/184938
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Steve Fung <stevefung@chromium.org>
Tested-by: Steve Fung <stevefung@chromium.org>
Commit-Queue: Steve Fung <stevefung@chromium.org>
diff --git a/common.sh b/common.sh
index 9577aab..b5beea2 100644
--- a/common.sh
+++ b/common.sh
@@ -50,7 +50,7 @@
 V_REVERSE=
 V_VIDOFF=
 
-if tput colors >&/dev/null; then
+if [[ -t 1 ]] && tput colors >&/dev/null; then
   # order matters: we want VIDOFF last so that when we trace with `set -x`,
   # our terminal doesn't bleed colors as bash dumps the values of vars.
   V_BOLD_RED=$(tput bold; tput setaf 1)