Why can't Python rich print text styles, only colors, on Windows command line?

Issue

The problem is that I can’t print any text style.

This is my code, and I don’t think it’s faulty:

from rich.console import Console

console = Console(highlight=False)

console.print("Test print")
console.print("[green]Test print (green)")
console.print("[bold]Test print (bold)")
console.print("[bold underline]Test print (bold underline)")

input()

This is what I get after running the script:

screenshot of terminal output

And this is what I get when I run

python -m rich

in the cmd:

screenshot of terminal output of "python -m rich"

What should I do? I tried it on Windows Terminal (from MS Store), and I got much more color and all the text styles, but I can’t set Windows Terminal as default (I have Windows 10, not Windows 11).

Solution

The classic Windows terminal doesn’t support any of the text styles, and only 16 colours.

Answered By – Will McGugan

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published