This commit is contained in:
Will McGugan 2020-01-08 11:51:49 +00:00
parent a68bae9f9b
commit c9ce00abe0
8 changed files with 153 additions and 72 deletions

View file

@ -1,3 +1,23 @@
Console API
===========
For more finely grained control over terminal formatting, Rich offers a :class:`~rich.console.Console` class. Most applications will require a single Console instance, so you may want to create one at the module level or as an attribute of your top-level object.
from rich.console import Console
console = Console()
Attributes
----------
The console will auto-detect a number of properties required when rendering.
* :obj:`~rich.console.Console.size` is the current dimensions of the terminal (which may change if you resize the window).
* :obj:`~rich.console.Console.encoding` is the default encoding (typically "utf-8").
* :obj:`~rich.console.Console.is_terminal` is a boolean that indicates if the Console instance is writing to a terminal or not.
* :obj:`~rich.console.Console.color_system` is a string containing "standard", "256" or "truecolor", or `None` if not writing to a terminal.
Printing
--------