Search code examples
pythonwindowsrich

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


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.