From e66dc6f7078e1d4928ef58ccf48f4718b61d8c35 Mon Sep 17 00:00:00 2001 From: Todd Leonhardt Date: Thu, 6 Feb 2020 22:50:00 -0500 Subject: Having two parallel datastructures each for foreground and background colors felt really clunky - now we just have one The Enum classes are now smart and deal with it all. --- examples/initialization.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'examples/initialization.py') diff --git a/examples/initialization.py b/examples/initialization.py index c13ed137..609255f1 100755 --- a/examples/initialization.py +++ b/examples/initialization.py @@ -13,8 +13,7 @@ 10) How to make custom attributes settable at runtime """ import cmd2 -from cmd2 import style -from cmd2.ansi import FG_COLORS +from cmd2 import style, fg, bg class BasicApp(cmd2.Cmd): @@ -25,7 +24,7 @@ class BasicApp(cmd2.Cmd): startup_script='scripts/startup.txt', use_ipython=True) # Prints an intro banner once upon application startup - self.intro = style('Welcome to cmd2!', fg='red', bg='white', bold=True) + self.intro = style('Welcome to cmd2!', fg=fg.red, bg=bg.white, bold=True) # Show this as the prompt when asking for input self.prompt = 'myapp> ' @@ -44,7 +43,7 @@ class BasicApp(cmd2.Cmd): # Make echo_fg settable at runtime self.add_settable(cmd2.Settable('foreground_color', str, 'Foreground color to use with echo command', - choices=FG_COLORS)) + choices=fg.colors())) @cmd2.with_category(CUSTOM_CATEGORY) def do_intro(self, _): -- cgit v1.2.1