diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-02-06 22:50:00 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2020-02-06 22:50:00 -0500 |
commit | e66dc6f7078e1d4928ef58ccf48f4718b61d8c35 (patch) | |
tree | efbdf93ee7c44acce04cd6758eee4c155838001f /docs/features | |
parent | ede9f3e77a59281a442227ed9b4b92e62e85d2b9 (diff) | |
download | cmd2-git-e66dc6f7078e1d4928ef58ccf48f4718b61d8c35.tar.gz |
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.
Diffstat (limited to 'docs/features')
-rw-r--r-- | docs/features/initialization.rst | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/docs/features/initialization.rst b/docs/features/initialization.rst index d48290fa..063ad4d0 100644 --- a/docs/features/initialization.rst +++ b/docs/features/initialization.rst @@ -19,8 +19,7 @@ capabilities which you may wish to utilize while initializing the app:: 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): CUSTOM_CATEGORY = 'My Custom Commands' @@ -30,7 +29,7 @@ capabilities which you may wish to utilize while initializing the app:: 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> ' @@ -51,7 +50,7 @@ capabilities which you may wish to utilize while initializing the app:: 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, _): |