 ¶
¶
This library is a wrapper of the great rich library that extends rich.text.Text to allow for the easy generation gradient text from either user entered colors or randomly if no colors are entered.
Borrowing from rich-color-ext rich_gradient extends the rich standard colors to include:
- 3 or 6 digit hex code (e.g. #f00or#FF0000)
- RGB color codes (e.g. rgb(255, 0, 0))
- RGB tuples   (e.g. (255, 0, 0))
- CSS3 Color Names (e.g. rebeccapurple)
Installation¶
uv (Recommended)¶
Pip¶
Usage¶
Text Example¶
To print a simple gradient import the Text class from in the rich_gradient library:
Gradient¶
If just text is boring, rich_gradient.gradient.Gradient allows you to apply a gradient to any rich.console.ConsoleRenderable. Such as a rich.panel.Panel or rich.table.Table;
table = Table(
    title="Gradient Table Example",
    border_style="bold",
)
table.add_column(
    "Renderable",
    style="bold",
    vertical="middle",
    justify="right"
)
table.add_column("Works w/Gradient", justify="left", style="bold")
renderables = [
    "Text",
    "Panel",
    "Syntax",
    "Table",
    "Live",
    "Group",
    "Markdown"
]
for renderable in renderables:
    table.add_row(
        renderable,
        "[b]:heavy_check_mark:[/b]"
    )
console.print(Gradient(table, rainbow=True), justify="center")