Skip to content

[BUG]In the latest versions rich "Title" without color #3569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
snooppr opened this issue Nov 21, 2024 · 6 comments · May be fixed by #3718
Closed

[BUG]In the latest versions rich "Title" without color #3569

snooppr opened this issue Nov 21, 2024 · 6 comments · May be fixed by #3718

Comments

@snooppr
Copy link

snooppr commented Nov 21, 2024

rich v 13.0.1 Title is painted over, see screenshot
rich v13.9.4r Title unpainted, see screenshot

OS GNU/Linux and OS Windows

from rich.console import Console
from rich.panel import Panel
from rich.style import Style
import os

console = Console()
console.print(Panel(str(os.environ), title='[bold white]Title[/bold white]', style=Style(color="white", bgcolor="blue")))

rich
Title should be like on the first screen (white on blue), in the second case (updated rich) white on dark (bug?)

Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

@snooppr
Copy link
Author

snooppr commented Nov 30, 2024

console.print(Panel(str(os.environ), title='[white on blue]Title[/white on blue]', style=Style(color="white", bgcolor="blue")))
Filling the title with a separate color does not solve the problem (it is also not completely filled).
2024-11-30

Correct result (1 screen, completely painted over header). Workaround is to use rich v 13.0.1.
Is there a fix planned?

@snooppr
Copy link
Author

snooppr commented May 1, 2025

@willmcgugan
can you tell me something useful about the open issue that hasn't been updated for 5 months. Because of this problem, I'm forced not to update rich in my projects since version 13.0.1.

@TomJGooding
Copy link
Contributor

@snooppr I'm not Will, but perhaps as a workaround in the meantime you could try setting the border_style to the same background as the panel? For example:

from rich.console import Console
from rich.panel import Panel
from rich.style import Style

console = Console()
console.print(
    Panel(
        "Content",
        title="[bold white]Title[/bold white]",
        style=Style(color="white", bgcolor="blue"),
        border_style=Style(bgcolor="blue"),
    )
)

It looks like there's a history of issues related to the panel title style, so any fix for this issue should be careful not to cause any regressions...

@snooppr
Copy link
Author

snooppr commented May 1, 2025

@TomJGooding
Thanks, the "border_style" hack solves the problem. Works in both old and new versions of rich.

@snooppr snooppr closed this as completed May 1, 2025
Copy link

github-actions bot commented May 1, 2025

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual

TomJGooding added a commit to TomJGooding/rich that referenced this issue May 1, 2025
Fix `Panel` title missing the panel background style.

This really just reverts the change in 7a38204. There's a history of
issues related to the panel title styles, so I was careful to run all
the examples in those issues to ensure there wasn't any regression.

Fixes Textualize#3569
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants