Only set terminal text colour if we are actually writing to a terminal.