mirror of https://github.com/Textualize/rich.git
Merge pull request #1730 from nathanrpage97/feat/docs-add-default-theme-appendix
Docs add default theme appendix
This commit is contained in:
commit
f5829f7f9f
|
@ -141,9 +141,10 @@ The Theme class will inherit the default styles built-in to Rich. If your custom
|
|||
|
||||
You can disable inheriting the default theme by setting ``inherit=False`` on the :class:`rich.theme.Theme` constructor.
|
||||
|
||||
To see the default theme, run the following command::
|
||||
To see the default theme, run the following commands::
|
||||
|
||||
python -m rich.theme
|
||||
python -m rich.default_styles
|
||||
|
||||
|
||||
Loading Themes
|
||||
|
|
|
@ -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 rich.console import Console
|
||||
from rich.table import Table
|
||||
from 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))
|
||||
|
|
Loading…
Reference in New Issue