diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-06-28 00:50:40 -0400 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2019-06-28 00:50:40 -0400 |
commit | 62327923a0f8db318dd6ff951b9d98a6b04bdbae (patch) | |
tree | 649ed339c867721c06ff57c67bb053a68f0a1a1a /cmd2 | |
parent | 307c53e9eb49aad69ba243e61d70474c384d185e (diff) | |
download | cmd2-git-62327923a0f8db318dd6ff951b9d98a6b04bdbae.tar.gz |
Updated Sphinx documentation and README.md
Diffstat (limited to 'cmd2')
-rw-r--r-- | cmd2/ansi.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd2/ansi.py b/cmd2/ansi.py index 0e73ab57..081e28b7 100644 --- a/cmd2/ansi.py +++ b/cmd2/ansi.py @@ -132,17 +132,17 @@ def bg_lookup(bg_name: str) -> str: def style(text: Any, *, fg: str = '', bg: str = '', bold: bool = False, underline: bool = False) -> str: - """ - Applies styles to text + """Styles a string with ANSI colors and/or styles and returns the new string. + + The styling is self contained which means that at the end of the string reset code(s) are issued + to undo whatever styling was done at the beginning. :param text: Any object compatible with str.format() :param fg: foreground color. Expects color names in FG_COLORS (e.g. 'red'). Defaults to no color. :param bg: background color. Expects color names in BG_COLORS (e.g. 'black'). Defaults to no color. :param bold: apply the bold style if True. Defaults to False. :param underline: apply the underline style if True. Defaults to False. - :return: the stylized string - :raises ValueError if fg or bg color does cannot be found """ # List of strings that add style additions = [] |