| 197 | return proxy |
| 198 | |
| 199 | def supports_color(self, colorize=None, logfile=None): |
| 200 | colorize = self.colorize if colorize is None else colorize |
| 201 | if self.app.IS_WINDOWS: |
| 202 | # Windows does not support ANSI color codes. |
| 203 | return False |
| 204 | if colorize or colorize is None: |
| 205 | # Only use color if there's no active log file |
| 206 | # and stderr is an actual terminal. |
| 207 | return logfile is None and isatty(sys.stderr) |
| 208 | return colorize |
| 209 | |
| 210 | def colored(self, logfile=None, enabled=None): |
| 211 | return colored(enabled=self.supports_color(enabled, logfile)) |