(
self,
file: IO[str],
force_terminal: bool
)
| 186 | warnings.simplefilter("ignore") |
| 187 | |
| 188 | def _make_rich_console( |
| 189 | self, |
| 190 | file: IO[str], |
| 191 | force_terminal: bool |
| 192 | ) -> 'Console': |
| 193 | from rich.console import Console |
| 194 | from httpie.output.ui.rich_palette import _make_rich_color_theme |
| 195 | |
| 196 | style = getattr(self.args, 'style', None) |
| 197 | theme = _make_rich_color_theme(style) |
| 198 | # Rich infers the rest of the knowledge (e.g encoding) |
| 199 | # dynamically by looking at the file/stderr. |
| 200 | return Console( |
| 201 | file=file, |
| 202 | force_terminal=force_terminal, |
| 203 | no_color=(self.colors == 0), |
| 204 | theme=theme |
| 205 | ) |
| 206 | |
| 207 | # Rich recommends separating the actual console (stdout) from |
| 208 | # the error (stderr) console for better isolation between parts. |
no test coverage detected