color_print

astropy.utils.console.color_print(*args, **kwargs) [edit on github][source]

Prints colors and styles to the terminal uses ANSI escape sequences.

color_print('This is the color ', 'default', 'GREEN', 'green')
Parameters :

positional args : strings

The positional arguments come in pairs (msg, color), where msg is the string to display and color is the color to display it in.

color is an ANSI terminal color name. Must be one of: black, red, green, brown, blue, magenta, cyan, lightgrey, default, darkgrey, lightred, lightgreen, yellow, lightblue, lightmagenta, lightcyan, white, or ‘’ (the empty string).

file : writeable file-like object, optional

Where to write to. Defaults to sys.stdout. If file is not a tty (as determined by calling its isatty member, if one exists), no coloring will be included.

end : str, optional

The ending of the message. Defaults to \n. The end will be printed after resetting any color or font state.

Page Contents