pg.utils.colored_block¶
Accessible via pg.utils.colored_block.
- colored_block(text, block_start, block_end, color=None, background=None, styles=None)[source]¶
Apply colors to text blocks.
- Return type:
- Parameters:
text – A string that may or may not already has ANSI color characters.
block_start – A string that signals the start of a block. E.g. ‘{{’
block_end – A string that signals the end of a block. E.g. ‘}}’.
color – A string for text colors. Applicable values are: ‘red’, ‘green’, ‘yellow’, ‘blue’, ‘magenta’, ‘cyan’, ‘white’.
background – A string for background colors. Applicable values are: ‘red’, ‘green’, ‘yellow’, ‘blue’, ‘magenta’, ‘cyan’, ‘white’.
styles – A list of strings for applying styles on the text. Applicable values are: ‘bold’, ‘dark’, ‘underline’, ‘blink’, ‘reverse’, ‘concealed’.
- Returns:
A string with ANSI color characters embracing the matched text blocks.