I found useful package rich. And want to use it in the next way: drawing in different colors words in sentence and at different background colors. I use next code:
from rich.console import Console
console = Console()
console.print('[green]some[/green] [#F47983]text[/#F47983]')
This way I can set any color for any word:
But I don't know, how to set different background colors. I tried background=
, bg:
and backgrounp-color
- this doesn't work :(
console.print('[green on #F47983]some[/green on #F47983] [#F47983]text[/#F47983]')
I added info to your answer :) – Urbanna