ThrowColour
ThrowColour is a small Python module to make printing messages with formatting and colours easier! This module is mostly just practice with creating a working pip module for learning purposes.
Features
- Supports different types of print messages with colour coding
- Support basic formatting (bold, italics)
- Supports timestamp printing
Usage
Getting it
To download throwcolour, either fork this Github repo or simply use Pypi via pip.
$ pip install ThrowColour
Using it
A few functional examples of how to use ThrowColour.
Basic Functionality
A basic example of how to use the cthrow function.
from ThrowColour import cthrow
cthrow('Test 1,2')
This would print the message DATETIME - [INFO] Test 1,2 in a nice looking purple with DATETIME replaced with the current timestamp.
The cthrow function
The full cthrow function is as follows:
cthrow(message, type='INFO', formatting=None, addPrefix=True, dateTime=True)
Setting the type argument
As you can see, a flag can be specified. This specifies the colour of the message and the message type. When setting flags, ensure the strings match exactly the name of the flag detailed below.
- INFO - A nice aesthetic purple message
- OK - A satisfying green message
- WARN - A cautionary yellow message
- ERR - A not-so-good red message
For example:
cthrow("This probably isn't good", type="WARN")
The addPrefix and dateTime arguments
We can also disable the prefix (the stuff inside the []) and timestamp as follows.
cthrow("Look Mom, no prefix and timestamp!", addPrefix=False, dateTime=False)
Setting formatting flags
With ThrowColour it is also possible to set multiple formatting flags such as bold and italics. It is important to note that the argument formatting takes a list containing strings of different formatting options.
cthrow("Bold and Underlined", formatting=['BOLD','UNDERLINE'])
Or just bolded,
cthrow("Nice and bold", formatting=['BOLD'])
Release files for ThrowColour-jzhao 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ThrowColour-jzhao-1.0.4.tar.gz | 2.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ThrowColour_jzhao-1.0.4-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 5.3 kB
Release files / ThrowColour-jzhao-1.0.4.tar.gz
| Download URL | ThrowColour-jzhao-1.0.4.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9136fcde38f8b4f583c792f814971d78af7c3adf633a3c37ef5b5d32b3617f10
|
|
BLAKE2b-256 checksum How to use checksums |
f0be144f2b3dd6ad0012353bcad77bdc975d1571949701b1f700fe022835efb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15rc1
|
Release files / ThrowColour_jzhao-1.0.4-py2-none-any.whl
| Download URL | ThrowColour_jzhao-1.0.4-py2-none-any.whl |
|---|---|
| Size | 3.1 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
5cd4a8a44f41a0c9edcbe85e8e77be395fb8c6a01105e55a94f464386f7e8fe9
|
|
BLAKE2b-256 checksum How to use checksums |
861072f92b4bc1ddfc04c3e7cc01d04eca0f9a1dd0330a65e7dc6ff6710db0a4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.15rc1
|