Textualize /rich
Rich is a Python library for rich text and beautiful formatting in the terminal.
★ 57,812⑂ 2,506👁 522⑃ 1,504● 1,565▤ 177
+10
日增长
+48
周增长
57,812
stars
2,506
forks
522
watchers
1,504
prs
1,565
issues
177
releases
README
!Logo
English readme
• 简体中文 readme
• 正體中文 readme
• Lengua española readme
• Deutsche readme
• Läs på svenska
• 日本語 readme
• 한국어 readme
• Français readme
• Schwizerdütsch readme
• हिन्दी readme
• Português brasileiro readme
• Italian readme
• Русский readme
• Indonesian readme
• فارسی readme
• Türkçe readme
• Polskie readme
Rich is a Python library for _rich_ text and beautiful formatting in the terminal.
The Rich API makes it easy to add color and style to terminal output. Rich can also render pretty tables, progress bars, markdown, syntax highlighted source code, tracebacks, and more — out of the box.
!Features
For a video introduction to Rich see calmcode.io by @fishnets88.
See what people are saying about Rich.
Compatibility
Rich works with Linux, macOS and Windows. True color / emoji works with new Windows Terminal, classic terminal is limited to 16 colors. Rich requires Python 3.8 or later.
Rich works with Jupyter notebooks with no additional configuration required.
Installing
Install with pip or your favorite PyPI package manager.
sh
python -m pip install rich
Run the following to test Rich output on your terminal:
sh
python -m rich
Rich Print
To effortlessly add rich output to your application, you can import the rich print method, which has the same signature as the builtin Python function. Try this:
python
from rich import print
print("Hello, [bold magenta]World[/bold magenta]!", ":vampire:", locals())
!Hello World
Rich REPL
Rich can be installed in the Python REPL, so that any data structures will be pretty printed and highlighted.
python
from rich import pretty
pretty.install()
!REPL
Using the Console
For more control over rich terminal content, import and construct a Console object.
python
from rich.console import Console
console = Console()
The Console object has a print method which has an intentionally similar interface to the builtin print function. Here's an example of use:
python
console.print("Hello", "World!")
As you might expect, this will print "Hello World!" to the terminal. Note that unlike the builtin print function, Rich will word-wrap your text to fit within the terminal width.
There are a few ways of adding color and style to your output. You can set a style for the entire output by adding a style keyword argument. Here's an example:
python
console.print("Hello", "World!", style="bold red")
The output will be something like the following:
!Hello World
That's fine for styling a line of text at a time. For more finely grained styling, Rich renders a special markup which is similar in syntax to bbcode. Here's an example:
python
console.print("Where there is a [bold cyan]Will[/bold cyan] there [u]is[/u] a [i]way[/i].")
!Console Markup
You can use a Console object to generate sophisticated output with minimal effort. See the Console API docs for details.
Rich Inspect
Rich has an inspect function which can produce a report on any Python object, such asTop issues
#2793[BUG] JupyterMixin adds spurious trailing newline17 comments · 2023-02-02#1859[REQUEST] Support for PEP 654 tracebacks (ExceptionGroups)14 comments · 2022-01-22#2691console.status 'blinking' artifact13 comments · 2022-12-07#3264[BUG] Addressing Dashboard Freeze and Cursor Flicker Issues in Real-Time Data Applications Using Rich11 comments · 2024-01-25#3049[BUG] box.py susceptible to breakage when commited with trailing-whitespace pre-commit hook11 comments · 2023-07-21#4208[BUG]Console.save_text clears recorded output when file write fails9 comments · 2026-08-16#2073[BUG] When pretty-printed, items with a multi-line repr are not indented10 comments · 2022-03-16#4161[/usr/local/lib/python3.14/site-packages/rich/segment.py:547: SyntaxWarning: 'return' in a 'finally' block return9 comments · 2026-06-14
Discussions
#4248Documentation improvements, how do I suggest fixes/make changes?3 comments · 2026-11-05#4236Optional OSC 7501 (Program Status Protocol) reporting from Progress/Status/Live0 comments · 2026-10-08#4230Please tell me how to fix this strange colouring scheme 'e:ba' and 'e:fe' turns out green2 comments · 2026-09-25#4227[REQUEST] Filtering select() items from keyboard for huge option list1 comments · 2026-09-22#4221Suggestion: Supported way to override the SVG `@font-face` block2 comments · 2026-09-14#4219Looking to Contribute - What Should I Work On?1 comments · 2026-09-07#4218Embed Agent-Friendly Score badge in README0 comments · 2026-09-05#4217More meaningful default for colors0 comments · 2026-09-04
Latest release
The So Long 3.8 Release v15.0.0 2026-04-12A few fixes. The major version bump is to honor the passing of 3.8 support which reached its EOL in October 7, 2024 [15.0.0] - 2026-04-12 Changed - Breaking change: Dropped support for Python3.8 Fixed - Fixed empty print ignoring the end parameter https://github.com/Textualize/rich/pull/4075 - Fixed Text.from_ansi removing newlines https://github.com/Textualize/rich/pull/4076 - Fixed FileProxy.isatty not proxying https://github.com/Textualize/rich/pull/4077 - Fixed inline code in Markdown tables cells https://github.com/Textualize/rich/pull/4079