Textualize / rich

Rich is a Python library for rich text and beautiful formatting in the terminal.
https://rich.readthedocs.io/en/latest/
MIT License
49.05k stars 1.71k forks source link

[BUG] Some colors aren't printed in bold #3275

Closed johndoknjas closed 7 months ago

johndoknjas commented 7 months ago

Describe the bug Some colors printed in bold have a clear visual difference, but for others it appears there is no change. I've included some examples of these in this code:

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

console = Console()

def print_colors(l: list[str], message: str) -> None:
    print(message)
    for c in l:
        console.print("not bold", style=Style(color=c, bold=False))
        console.print("bold", style=Style(color=c, bold=True))
        print('\n')

print_colors(['bright_red', 'grey100', 'grey39', 'bright_magenta', 'purple'], 
             "For these colors, the bold parameter seems to make no visual difference:\n")
print_colors(['white', 'red', 'magenta'], 
             "------------------------------\nFor these colors, the bold parameter does make a difference:\n")

The output on my end: image

Platform Windows 11

What platform (Win/Linux/Mac) are you running on? What terminal software are you using? Windows PowerShell

I may ask you to copy and paste the output of the following commands. It may save some time if you do it now.

If you're using Rich in a terminal:

python -m rich.diagnose
pip freeze | grep rich

If you're using Rich in a Jupyter Notebook, run the following snippet in a cell and paste the output in your bug report.

from rich.diagnose import report
report()

github-actions[bot] commented 7 months ago

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

TomJGooding commented 7 months ago

This isn't a Rich issue but rather just how your terminal emulator renders bold text.

If you're using Windows Terminal, I think there's a setting under Appearance you can change.

johndoknjas commented 7 months ago

@TomJGooding Thanks, you're right - the setting is this. In case anyone else sees this, to update it I did the following:

github-actions[bot] commented 7 months ago

I hope we solved your problem.

If you like using Rich, you might also enjoy Textual