summaryrefslogtreecommitdiff
path: root/docs/features/initialization.rst
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2020-02-06 23:52:31 -0500
committerGitHub <noreply@github.com>2020-02-06 23:52:31 -0500
commit3f075900264fee32c356aac3d03b2568664ba684 (patch)
tree81a8935b7a2b8ea1c7ba429a3bde25db9c33deee /docs/features/initialization.rst
parent3c627af7c1e22bcd0cd0a49dee05fd6b626bccc5 (diff)
parent138c28d18cee56ae09416cc00d2d461e983d90e8 (diff)
downloadcmd2-git-3f075900264fee32c356aac3d03b2568664ba684.tar.gz
Merge pull request #876 from python-cmd2/color_autocomplete
Added convenience enums of fg and bg colors
Diffstat (limited to 'docs/features/initialization.rst')
-rw-r--r--docs/features/initialization.rst7
1 files changed, 3 insertions, 4 deletions
diff --git a/docs/features/initialization.rst b/docs/features/initialization.rst
index 5721caa3..6824c7bf 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, _):