fix color if not a TTY, add check for grid env and minor refactoring