Calmcode - rich: theme

Defining themes in Rich.

1 2 3 4 5 6 7 8 9 10 11 12

You can make your own themes for rich. This is great if you're interested in rendering predefined styles.

from rich.console import Console
from rich.theme import Theme

custom_theme = Theme({
    "good" : "green",
    "bad": "bold red"
})

console = Console(theme=custom_theme)
console.print("File downloaded!", style="good")
console.print("File corrupted!", style="bad")
console.print("The internet is [bad]down![/bad]")