diff options
Diffstat (limited to 'src/pip/_vendor/rich/default_styles.py')
-rw-r--r-- | src/pip/_vendor/rich/default_styles.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/pip/_vendor/rich/default_styles.py b/src/pip/_vendor/rich/default_styles.py index 355f9df85..91ab232d3 100644 --- a/src/pip/_vendor/rich/default_styles.py +++ b/src/pip/_vendor/rich/default_styles.py @@ -157,3 +157,27 @@ DEFAULT_STYLES: Dict[str, Style] = { "markdown.link": Style(color="bright_blue"), "markdown.link_url": Style(color="blue"), } + + +if __name__ == "__main__": # pragma: no cover + import argparse + import io + + from pip._vendor.rich.console import Console + from pip._vendor.rich.table import Table + from pip._vendor.rich.text import Text + + parser = argparse.ArgumentParser() + parser.add_argument("--html", action="store_true", help="Export as HTML table") + args = parser.parse_args() + html: bool = args.html + console = Console(record=True, width=70, file=io.StringIO()) if html else Console() + + table = Table("Name", "Styling") + + for style_name, style in DEFAULT_STYLES.items(): + table.add_row(Text(style_name, style=style), str(style)) + + console.print(table) + if html: + print(console.export_html(inline_styles=True)) |