From ede9f3e77a59281a442227ed9b4b92e62e85d2b9 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Thu, 6 Feb 2020 21:28:06 -0500 Subject: Added convenience `ansi.fg` and `ansi.bg` enums of foreground and background colors which style() can now optionally use This is to make it easier to autocomplete color names in an IDE --- examples/basic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples') diff --git a/examples/basic.py b/examples/basic.py index 37db6501..5df3d1b5 100755 --- a/examples/basic.py +++ b/examples/basic.py @@ -9,7 +9,7 @@ 6) Shell-like capabilities """ import cmd2 -from cmd2 import style +from cmd2 import style, fg, bg class BasicApp(cmd2.Cmd): @@ -19,7 +19,7 @@ class BasicApp(cmd2.Cmd): super().__init__(multiline_commands=['echo'], persistent_history_file='cmd2_history.dat', startup_script='scripts/startup.txt', use_ipython=True) - self.intro = style('Welcome to PyOhio 2019 and cmd2!', fg='red', bg='white', bold=True) + ' 😀' + self.intro = style('Welcome to PyOhio 2019 and cmd2!', fg=fg.red, bg=bg.white, bold=True) + ' 😀' # Allow access to your application in py and ipy via self self.self_in_py = True -- cgit v1.2.1