astropy.utils.console.color_print(*args, end='\n', **kwargs)[source]#

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

color_print('This is the color ', 'default', 'GREEN', 'green')
positional argsstr

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).

filefile-like (writeable), 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.

endstr, optional

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