From 92f8e3d616c836748638a19ad954c7e050059f21 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Wed, 26 Jun 2019 17:15:43 -0400 Subject: Updated documentation --- cmd2/ansi.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cmd2/ansi.py') diff --git a/cmd2/ansi.py b/cmd2/ansi.py index 97fb1e8a..8980b1d4 100644 --- a/cmd2/ansi.py +++ b/cmd2/ansi.py @@ -80,7 +80,7 @@ UNDERLINE_DISABLE = colorama.ansi.code_to_chars(24) def style(text: Any, *, fg: str = '', bg: str = '', bold: bool = False, underline: bool = False) -> str: """ - Applies a style to text + Applies styles to text :param text: Any object compatible with str.format() :param fg: foreground color. Expects color names in FG_COLORS (e.g. 'lightred'). Defaults to no color. @@ -126,7 +126,9 @@ def style(text: Any, *, fg: str = '', bg: str = '', bold: bool = False, underlin return "".join(additions) + text + "".join(removals) -# Default styles. These can be altered to suit an application's needs. +# Default styles for printing strings of various types. +# These can be altered to suit an application's needs and only need to be a +# function with the following structure: func(str) -> str style_success = functools.partial(style, fg='green', bold=True) style_warning = functools.partial(style, fg='lightyellow') style_error = functools.partial(style, fg='lightred') -- cgit v1.2.1