Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kennethreitz/crayons
Text UI colors for Python.
https://github.com/kennethreitz/crayons
colorama colors python text textui
Last synced: 29 days ago
JSON representation
Text UI colors for Python.
- Host: GitHub
- URL: https://github.com/kennethreitz/crayons
- Owner: kennethreitz
- License: mit
- Created: 2017-01-20T00:22:07.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2020-08-26T21:33:30.000Z (over 4 years ago)
- Last Synced: 2024-08-04T04:04:32.311Z (4 months ago)
- Topics: colorama, colors, python, text, textui
- Language: Python
- Homepage: https://pypi.python.org/pypi/crayons
- Size: 38.1 KB
- Stars: 424
- Watchers: 23
- Forks: 30
- Open Issues: 3
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
- starred-awesome - crayons - Text UI colors for Python. (Python)
README
Crayons: Text UI colors for Python.
===================================.. image:: https://img.shields.io/pypi/v/crayons.svg
:target: https://pypi.org/project/crayons/.. image:: https://github.com/MasterOdin/crayons/workflows/Test/badge.svg
:target: https://github.com/MasterOdin/crayons/actions?query=workflow%3ATest+branch%3Amaster.. image:: https://img.shields.io/pypi/l/crayons.svg
:target: https://pypi.python.org/pypi/crayons.. image:: https://img.shields.io/pypi/wheel/crayons.svg
:target: https://pypi.python.org/pypi/crayons.. image:: https://img.shields.io/pypi/pyversions/crayons.svg
:target: https://pypi.python.org/pypi/crayonsThis 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... image:: 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 whiteThat's it!
Installation
------------::
$ pip install crayons