Skip to main content

TextUI colors for Python.

Project description

https://img.shields.io/pypi/v/crayons.svg https://travis-ci.com/MasterOdin/crayons.svg?branch=master https://img.shields.io/pypi/l/crayons.svg https://img.shields.io/pypi/wheel/crayons.svg https://img.shields.io/pypi/pyversions/crayons.svg

This module is really simple, it gives you colored strings for terminal usage. Included colors are red, green, yellow, blue, black, magenta, cyan, white, and normal (as well as clean and disable).

Crayons is nice because it automatically wraps a given string in both the foreground color, as well as returning to the original state after the string is complete. Most terminal color libraries make you manage this yourself.

https://d3vv6lp55qjaqc.cloudfront.net/items/3q0I293q1z293R3a3a3n/Screen%20Shot%202017-01-23%20at%206.00.02%20PM.png?X-CloudApp-Visitor-Id=2577

Arguments include always=True and bold=True.

Features

  • If you call disable(), all future calls to colors will be ignored.

  • If you call normal(), color is reset to default foreground color

  • If the current process is not in a TTY (e.g. being piped), no colors will be displayed.

  • Length of ColoredStrings can be properly calculated.

  • Powered by colorama.

Usage is simple

# red is red, white is white.
>>> print('{} white'.format(crayons.red('red')))
red white

That’s it!

Installation

$ pip install crayons

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crayons-0.3.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

crayons-0.3.1-py2.py3-none-any.whl (4.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file crayons-0.3.1.tar.gz.

File metadata

  • Download URL: crayons-0.3.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for crayons-0.3.1.tar.gz
Algorithm Hash digest
SHA256 dcb85b87aa03bb65bd3a073d012796b024cabeb086033e616759e2abb769440b
MD5 724bac384d14321a318eb3103a4e5314
BLAKE2b-256 a67ca11e6eb6e405a8279f4297019570580b2efd3a90fe3dfe65d13aaae31522

See more details on using hashes here.

Provenance

File details

Details for the file crayons-0.3.1-py2.py3-none-any.whl.

File metadata

  • Download URL: crayons-0.3.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3

File hashes

Hashes for crayons-0.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4066ec91fecd6b86755d3f083943815e5958688aecdfae54b24443f190ba6950
MD5 d26a7596e1b5db8fc3224e05bc92cba9
BLAKE2b-256 a619185ee40d06e3b67f9e92c45cc6ff30f4573f610a8b575e4a02629a34705a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page