Skip to main content
https://img.shields.io/pypi/v/crayons.svg https://github.com/MasterOdin/crayons/workflows/Test/badge.svg 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

Metadata

Release files for crayons 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crayons 0.4.0
File Size Uploaded
crayons-0.4.0.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for crayons 0.4.0
File Interpreter ABI Platform
crayons-0.4.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 9.2 kB

Release files / crayons-0.4.0.tar.gz

Download URL crayons-0.4.0.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
bd33b7547800f2cfbd26b38431f9e64b487a7de74a947b0fafc89b45a601813f
BLAKE2b-256 checksum
How to use checksums
b86b12a1dea724c82f1c19f410365d3e25356625b48e8009a7c3c9ec4c42488d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release files / crayons-0.4.0-py2.py3-none-any.whl

Download URL crayons-0.4.0-py2.py3-none-any.whl
Size 4.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e73ad105c78935d71fe454dd4b85c5c437ba199294e7ffd3341842bc683654b1
BLAKE2b-256 checksum
How to use checksums
5b0de3fad4ca1de8e70e06444e7d777a5984261e1db98758b5be3e8296c03fe9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.3.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page