Pastel

0.2.1 · maintenance · verified Thu Apr 09

Pastel is a simple Python library (current version 0.2.1) designed to bring colors to your terminal output. It provides an easy way to colorize strings using a simple tag-based syntax and comes with predefined styles like 'info' (green), 'comment' (yellow), 'question' (black on cyan), and 'error' (white on red). The library's last release was in September 2020, indicating a low release cadence and maintenance-focused status.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to import the `pastel` library, apply predefined and custom styles to strings, and how to programmatically enable or disable color output.

import pastel

# Using a predefined style
print(pastel.colorize('<info>Information</info>'))

# Using custom foreground color and options
print(pastel.colorize('<fg=red;options=bold>This is bold red text</>'))

# Using custom background color
print(pastel.colorize('<bg=blue>Blue background</bg>'))

# Disabling colors programmatically
pastel.with_colors(False)
print(pastel.colorize('<error>This will now be uncolored</error>'))
pastel.with_colors(True) # Re-enable for subsequent calls

view raw JSON →