fix rich export size

This commit is contained in:
Will McGugan
2022-11-06 16:19:58 +00:00
parent d76dd66118
commit 44debac54c
3 changed files with 7 additions and 2 deletions

View File

@@ -1,5 +1,5 @@
# API # API
This is a API-level reference to the Textual API. See the links on the left (or in the burger menu) for each module, where you can drill down to a class or method. This is a API-level reference to the Textual API. Click the links to your left (or in the burger menu) to open a reference for each module.
If you are new to Textual, you may want to read the [tutorial](./../tutorial.md) or [guide](../guide/index.md) first. If you are new to Textual, you may want to read the [tutorial](./../tutorial.md) or [guide](../guide/index.md) first.

View File

@@ -125,11 +125,16 @@ def rich(source, language, css_class, options, md, attrs, **kwargs) -> str:
title = attrs.get("title", "Rich") title = attrs.get("title", "Rich")
rows = int(attrs.get("lines", 24))
columns = int(attrs.get("columns", 80))
console = Console( console = Console(
file=io.StringIO(), file=io.StringIO(),
record=True, record=True,
force_terminal=True, force_terminal=True,
color_system="truecolor", color_system="truecolor",
width=columns,
height=rows,
) )
error_console = Console(stderr=True) error_console = Console(stderr=True)

View File

@@ -8,7 +8,7 @@ You can convert from a Textual color to a Rich color with the [rich_color][textu
The following named colors are used by the [parse][textual.color.Color.parse] method. The following named colors are used by the [parse][textual.color.Color.parse] method.
```{.rich title="colors"} ```{.rich columns="80" title="colors"}
from textual._color_constants import COLOR_NAME_TO_RGB from textual._color_constants import COLOR_NAME_TO_RGB
from textual.color import Color from textual.color import Color
from rich.table import Table from rich.table import Table