Colored Printing#
- skZemax.skZemax_subfunctions._c_print.c_print(text: str, end: str = '\n', flush: bool = False, command_marker: str = '!@', verbose: bool = True) str[source]#
Convenient function to print colored text to console. Colors for printed text are set by commands between the command markers (‘!@’ by default)
Example:
>>> from c_print import c_print as cp >>> cp('!@g!@Hello, !@b!@how are you today?')
This will output to console text with “Hello,” in green and “how are you today?” in blue.
Written by Daniel Letros
- Parameters:
text (str) – Text to print to screen including color/formatting commands.
end (str, optional) – What to end the string with. Defaults to newline, defaults to newline
flush (bool, optional) – Should force flush or not, Defaults to False.
command_marker (str, optional) – The bit of chars which surround a chunk of commands, Defaults to ‘!@’.
verbose (bool, optional) – Allows passage of a ‘verbose’ bool, Defaults to True.
- Returns:
Formatted text string for colored printing
- Return type:
str