Skip to main content

Easily print colored text.

Project description

# CliRAINBOW
Easily print colored text.

## Example usage
```python
>>> from clirainbow import Colorizer, RED, GREEN
>>> c = Colorizer()
>>> c.print('<hello> <world!>', RED, GREEN)
```

## Additional info

* If you want to insert a literal bracket, double it (e.g. write `<<` instead of `<`)
* (this is the same behavior as Python's builtins)
* Angle brackets are used instead of the traditional curly brackets in order to prevent clashes with Python's builtin string formatting facilities


## Exceptions

At the moment, three possible exceptions may occur while using the library :
1. A color bracket is opened, but never closed (`ColorBracketOpenedButNotClosed`)
2. More brackets than colors are given (`MoreBracketsThanColors`)
3. More colors than brackets are given (`MoreColorsThanBrackets`)

In each case, a readable error message is produced

## Disclaimer
Colors may not appear on certain systems (e.g., Windows) or with certain terminals.

## Dependencies
CliRAINBOW is built on top of colorama : https://github.com/tartley/colorama

## Future plans
* Generate code in `colors.py` with a script instead of at runtime
* Allow code completion
* Remove annoying error messages
* Add support for reusing colors by index, e.g. `c.print('<0:oh> <1:hai> <0:there>', colors.RED, colors.BLACK)`
* Make it more similar to Python's `format`


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

clirainbow-1.0.3.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

clirainbow-1.0.3-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file clirainbow-1.0.3.tar.gz.

File metadata

  • Download URL: clirainbow-1.0.3.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for clirainbow-1.0.3.tar.gz
Algorithm Hash digest
SHA256 5fbcce19754a2e8660041a77f9367bb5e74637dfe31467f09bdc07ff3678104a
MD5 f69815912904a37ff83635c6009a3d6f
BLAKE2b-256 4b3c66ee25a801d9031d4d089fa98ec16de6e05ad71399095f538abcfacecc1a

See more details on using hashes here.

File details

Details for the file clirainbow-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: clirainbow-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.6

File hashes

Hashes for clirainbow-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d2fc58e62fa10c2c32844be66a262e7c5e8783114c2328b99bba7d47d00858dc
MD5 1138d082080a4c2cc928c3e427e5b018
BLAKE2b-256 680cb3c260af1d5fc677523d5185077636db4da12b43b09fa5a914f76047aa39

See more details on using hashes here.

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