Skip to main content
`Ctrl`+`K`

# color_print

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

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

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

  Parameters:
    positional args `python:str`

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

    end `python:str`, optional

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