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`
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.1.0.tar.gz
(3.6 kB
view details)
Built Distribution
File details
Details for the file clirainbow-1.1.0.tar.gz
.
File metadata
- Download URL: clirainbow-1.1.0.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.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4de47c0a803a04500175857b53b5cc9430e124ea5c6182d233a9adba13015b4d |
|
MD5 | d2a964df7c459163aaefe80be604026c |
|
BLAKE2b-256 | 655903496fac32c12b70084066354eebc0afcb7c309c7a5419f021ca3274e32e |
File details
Details for the file clirainbow-1.1.0-py3-none-any.whl
.
File metadata
- Download URL: clirainbow-1.1.0-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.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 31e4137de8bceb01887fc37f86bd35c585a6badd061a5d76f2f29cafb62c4bf0 |
|
MD5 | 0b1971f76468b7605d645d126c610df0 |
|
BLAKE2b-256 | 6a73ee08722ef90da5e2f40f12445e7e2e3951630c4779da51b1f463c89af36b |