Usage
Applies to v2.0.0
The steps below describe the behaviour shipped with rich-color-ext
v0.1.9. If you are on an older release, upgrade with uv pip
install --upgrade rich-color-ext before following along.
Installing¶
Install using uv/uv pip (recommended):
Install from PyPI:
Basic usage¶
To enable the extended parsing behaviour, import and call install() once at
startup in your program.
from rich_color_ext import install
from rich.console import Console
install() # Patch Rich's Color.parse method
console = Console(width=64)
console.print(
"This text can include CSS colors like [bold rebeccapurple]rebeccapurple[/] or 3-digit hex like [#f0f]#f0f[/]."
)
The package also provides CSSColor helpers and a get_css_map() function to
inspect the canonical list of supported CSS named colours.