Skip to main content

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.

eg1


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")

eg2


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'])

eg3

Or just bolded,

cthrow("Nice and bold", formatting=['BOLD'])

eg4

Metadata

Release files for throwcolour 1.0.7

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

Built distributions (wheels)

Table of built distributions (wheels) for throwcolour 1.0.7
File Interpreter ABI Platform Actions
throwcolour-1.0.7-py3-none-any.whl Python 3 none any Details for throwcolour-1.0.7-py3-none-any.whl
throwcolour-1.0.7-py2-none-any.whl Python 2 none any Details for throwcolour-1.0.7-py2-none-any.whl

Total release size: 8.4 kB

Release files / throwcolour-1.0.7-py3-none-any.whl

Download URL throwcolour-1.0.7-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d5c20451130101d5c553f01d3290a0aa5171edebbfadd4a117af4369ed2ba6e9
BLAKE2b-256 checksum
How to use checksums
436510f88c11e4bee097140c5e98b0d819ccedfec180fd60f8a67f887be05faa
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-1.0.7-py2-none-any.whl

Download URL throwcolour-1.0.7-py2-none-any.whl
Size 3.7 kB
Tags Python 2
SHA-256 checksum
How to use checksums
4ba1282b7439ab0dccc37da5093c6ea3ca4f0ae68d4bf0bceab0b4546c0ee4b5
BLAKE2b-256 checksum
How to use checksums
5292c28909f3674a48521de53661d1e6065ef526ac1b8c5c0db271b229bd6ee2
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

Security for throwcolour 1.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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