Skip to main content

A small package to make printing pretty things easier!

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for throwcolour, version 1.0.7
Filename, size File type Python version Upload date Hashes
Filename, size throwcolour-1.0.7-py2-none-any.whl (3.7 kB) File type Wheel Python version py2 Upload date Hashes View hashes
Filename, size throwcolour-1.0.7-py3-none-any.whl (4.7 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page