astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v0.3 »
- Astropy Core Package Utilities (`astropy.utils`) »
- color_print

# color_print

`astropy.utils.console.``color_print`(*args, **kwargs)

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

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

  Parameters:

  positional args : 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 : 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.