ride.utils.logging¶
Module Contents¶
Functions¶
|
|
|
|
|
Styles a text with ANSI styles and returns the new string. By |
|
Attributes¶
- ride.utils.logging.style(text, fg=None, bg=None, bold=None, dim=None, underline=None, blink=None, reverse=None, reset=True)[source]¶
Styles a text with ANSI styles and returns the new string. By default the styling is self contained which means that at the end of the string a reset code is issued. This can be prevented by passing
reset=False.This is a modified version of the one found in click https://click.palletsprojects.com/en/7.x/
Examples:
logger.info(style('Hello World!', fg='green')) logger.info(style('ATTENTION!', blink=True)) logger.info(style('Some things', reverse=True, fg='cyan'))
Supported color names:
black(might be a gray)redgreenyellow(might be an orange)bluemagentacyanwhite(might be light gray)bright_blackbright_redbright_greenbright_yellowbright_bluebright_magentabright_cyanbright_whitereset(reset the color code only)
- Parameters:
text – the string to style with ansi codes.
fg – if provided this will become the foreground color.
bg – if provided this will become the background color.
bold – if provided this will enable or disable bold mode.
dim – if provided this will enable or disable dim mode. This is badly supported.
underline – if provided this will enable or disable underline.
blink – if provided this will enable or disable blinking.
reverse – if provided this will enable or disable inverse rendering (foreground becomes background and the other way round).
reset – by default a reset-all code is added at the end of the string which means that styles do not carry over. This can be disabled to compose styles.