Skip to content

Commit 4d9a4da

Browse files
committed
Using Rich Style objects and cmd2 color constants.
1 parent 3083e2d commit 4d9a4da

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

examples/async_printing.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from rich.console import Group
1212
from rich.panel import Panel
13+
from rich.style import Style
1314
from rich.table import Table
1415
from rich.text import Text
1516

@@ -31,13 +32,22 @@ def get_alerts() -> list[tuple[Any, bool]]:
3132
# to ensure they render as expected. For example, when soft_wrap is True, Panels truncate
3233
# text which is wider than the terminal.
3334
return [
34-
(Text("Watch as this application prints alerts asynchronously!", style="bold bright_cyan"), True),
35+
(
36+
Text(
37+
"Watch as this application prints alerts asynchronously!",
38+
style=Style(
39+
color=Color.BRIGHT_CYAN,
40+
bold=True,
41+
),
42+
),
43+
True,
44+
),
3545
("Notice how alerts don't interfere with your typing or cursor location.", True),
3646
(
3747
Panel(
3848
"This message is wrapped in a Rich Panel!",
3949
title="System Alert",
40-
border_style="bright_blue",
50+
border_style=Color.BRIGHT_BLUE,
4151
expand=False,
4252
),
4353
False,

0 commit comments

Comments
 (0)