pastel 0.2.1


pip install pastel

  Latest version

Released: Sep 16, 2020


Meta
Author: Sébastien Eustace
Requires Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*

Classifiers

License
  • OSI Approved :: MIT License

Programming Language
  • Python :: 2
  • Python :: 2.7
  • Python :: 3
  • Python :: 3.4
  • Python :: 3.5
  • Python :: 3.6
  • Python :: 3.7
  • Python :: 3.8
  • Python :: 3.9

Pastel is a simple library to help you colorize strings in your terminal.

It comes bundled with predefined styles:

  • info: green

  • comment: yellow

  • question: black on cyan

  • error: white on red

https://raw.githubusercontent.com/sdispater/pastel/master/assets/screenshot.png

Features

  • Use predefined styles or add you own.

  • Disable colors all together by calling with_colors(False).

  • Automatically disables colors if the output is not a TTY.

  • Used in cleo.

  • Supports Python 2.7+, 3.5+ and PyPy.

Usage

>>> import pastel
>>> print(pastel.colorize('<info>Information</info>'))
'Information'  # Green string by default
>>> print(pastel.colorize('<fg=red;options=bold>This is bold red</>'))
'This is bold red'

Installation

pip install pastel

Wheel compatibility matrix

Platform Python 2 Python 3
any

Files in release

No dependencies