
Security News
Security Community Slams MIT-linked Report Claiming AI Powers 80% of Ransomware
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.
rich-gradient
Advanced tools
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 pydantic-extra-types' Color class
As of v0.3.0, rich-gradient removed the color logic from rich-gradient and created rich-color-ext
#f00 or #ff0000)rgb(255, 0, 0))(255, 0, 0))red)Read the docs at rich-gradient.readthedocs.io
uv add rich-gradient
pip install rich-gradient
The package ships with a Typer-based CLI. The first command is text, which prints gradient-styled text. More commands may be added over time.
Print gradient text with two color stops:
rich-gradient text "Hello [b]world[/b]!" -c magenta -c cyan
Rainbow gradient (auto-generated colors):
rich-gradient text "Rainbow!" --rainbow
Read from stdin:
echo "From stdin" | rich-gradient text
Wrap in a panel with a title:
rich-gradient text "Panel content" --panel --title "Gradient Panel"
Save to SVG (uses the project terminal theme):
rich-gradient text "Save me" --save-svg out/example.svg
-c/--color: Repeat to add multiple foreground color stops.-b/--bgcolor: Repeat for background color stops.--rainbow, --hues: Auto-generate a palette if colors aren’t provided.--style, --justify, --overflow, --no-wrap/--wrap, --end, --tab-size, --markup/--no-markup.--panel, --title: Wrap output in a panel with optional title.--width: Console width. --record: enable recording.--save-svg PATH: Save the current render as SVG.To print a simple gradient just substitute the Gradient class for the Text class in the rich-gradient library.
from rich.console import Console
from rich_gradient import Gradient
console = Console()
console.print(Gradient("Hello, World!"))
If you want a bit more control of the gradient, you can specify the colors you want to use in the gradient by passing them as a list of colors to the colors parameter.
Color can be parsed from a variety of formats including:
console.print(
    Text(
        "This a gradient with two colors.",
        colors=["red", "orange"]
    ),
    justify="center"
)
console.print(
    Text(
        "This a gradient uses four specific colors.",
        colors=["red", "#ff9900", "#ff0", "Lime"],
        justify="center"
    )
)
If four colors isn't enough, you can use the 'rainbow' parameter to generate a rainbow gradient that spans the entire spectrum of colors randomly.
console.print(
    Text(
        "This is a rainbow gradient.",
        rainbow=True,
        justify="center"
    )
)
*The rainbow gradient is generated randomly each time the code is run.
rich.text.TextSince Gradient is a subclass of Text, you can still use all the same methods and properties as you would with Text.
console.print(
    Gradient(
        "This is an underlined rainbow gradient.",
        rainbow=True,
        style="underline"
    ),
    justify="center"
)
console.line()
console.print(
    Gradient(
        "This is a bold italic gradient.",
        style="bold italic"
    ),
    justify="center"
)
console.line()
FAQs
A gradient generator for the Rich library.
We found that rich-gradient demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.

Research
/Security News
Socket researchers found 10 typosquatted npm packages that auto-run on install, show fake CAPTCHAs, fingerprint by IP, and deploy a credential stealer.