A simple package to colour and style your text printed on the CLI.
Project description
Manychrome
This is a package predominantly created for those who prefer working from the CLI. It is to add colours and to style text so to easily make warnings, notification messages, or finding text when searching for it easily pop out.
Simple functions, with an intention to allow the user to simply just type ‘write’, or ‘listme’ or similar to get things done. The function names are intended to be logical and selfexplanatory and easy to remember.
[!NOTE] This package is currently being updated, and pip install is not working at the moment. It is in a public reposiory on GitHub so feel free to check out the code.
Installation
pip install manychrome
To uninstall use: pip uninstall manychrome
Background
This package was created because I prefer to work from the terminal and I wanted a simple way to let certain reminders and text manipulation to easily grab my attention. I also find myself to to repeat code again and again, and therefore wanted to create a package that I could just pip install and use in my different environments without having to repeat it in different directories.
I am new to coding, and this is my first package, so it might not yet follow all the right principles yet I hope it’ll over time be helpful to others who also like some colour on their cli.
My intention is to keep adding to it, and make it extremely user friendly.
For the interested one the name manychrome was selected as a play on the word monochrome to reflect it’s opposite nature.
What manychrome contains
Classes
Colorful()
Stylish()
FindMe()
What Colorful() can be used for
Colorful: simple functions that provide the additional benefit of colours when viewing the data.
Stylish: the intention of stylish is to provide CLI text styling also without color.
Findme: the intention is to easily find placeholders and other items in text and make them stand out in the whole context of the text. This to quickly get an overview of the text pertaining to the words or fragments of interest in the big scheme of things. Also provides an extremely simple and straight forward way to update placeholder text for emails, documents, and invoice creation etc.
How to Use manychrome
Use pip install manychrome Use pip uninstall manychrome to uninstall it
from colorful import Colorful
from stylish import Stylish
from findme import FindMe
Functions of Colorful()
c.write(words) # To simply print text (strings) with or without colour and style configuration. Use list me to instead view lists (it will pretty print the lists)
c.styleme(words) # Identical to write but returns the styed text instead of printing it, so it can be used for further text manipulation.
c.listme(list) # An extremely easy way to pretty print lists.
c.listme(list, heading="ACTIONS", heading_style=c) # Can add a heading to the list.
c.listme(list, heading="DIFFERENT", heading_style=h) # Can use a different instance for the heading style to make it stick out from the text in the list.
choose_color() # Just an extremely easy way to see the colours and it's corresponding value in order to select colours to use. Depending on theme settings and colours at the CLI or IDE used the colours might show up differently so good to be able to view them. This function does not belong to any class.
save_favs() # Creates an ini file to save the colour favourites to easily find the ones you like without having to remember the values or use choose_color(). This function does not belong to any class.
How to configure the colours when using Colorful()
For Colorful() the configuration can either be set when initiating the instance, or by setting the values. This makes for a super simple view to organise the differences especially when several different instances are created. Text can contain multiple different combinations by using several instances of Colorful() for different fragments of the text.
The different styles can also be combined so for example, text can be both underlined, and bold, and italics at the same time. If just wanting to print normally there is no need to do anything exept instantiate Colorful(). No values are required for normal printing of the text.
c = Colorful(fg=1, bg=2, it=True) # All config for Colorful() can be set inside here, or as shown below
c.fg = 1 # Sets the foreground (text) colour
c.bg = 2 # Sets the background colour
c.it = True # Set it as True for text in italics
c.ul = False # Set ul as True for underlined text
c.bo = False # Set bo as True for bold text
c.st = False # Set st as True for strikethrough
c.sh = False # Set sh as True to shift the colour between the foreground and the background
c.ft = False # Set ft as True for faint text. NOTE: This one is having varying effects and is not yet entierly reliable. There are some colours that can be selected in combination that prints very faint text. On my IDE and cli using fg=23, fg=33 prints very faint (but coloured) text.
Functions of FindMe()
See below for the current functions and config for class FindMe()
# Set the placeholders, no limit set for the number of placeholders.
f = FindMe(
placeholder="value"
company="Awesome company name",
email="colourful@email.com",
greeting="Ohoy there",
)
# The template containing the placeholders.
template = "{greeting}. For your template, make sure to wrap the {placeholder} in curly brackets, to update the values, such as {email}, and {company}"
# Configure the style and colour of the placeholder text.
f.fg=220
f.bg=33
f.it=True
# Prints the text.
f.showme(template)
The placeholders are to be wrapped in curly brackets in the template text, for where you want to change the text.
Functions of Stylish()
See below for the current functions and config for class Stylish(). There is a substantial overlap and ineffective intermixing between classes so might all get moved to Colorful().
These provide super self explanatory and easy to remember ways to print text on the cli in whatever style. The primary function of the name of these will ignore other configuration settings, thus these can be used in combination where some text is highlighted, and depending of choice it will not be affected by that.
findme(words) # TODO check this, it's the same as showme(). Make it make sense.
bold(words) # Prints the text bold.
italics(words) # Prints the text in italics.
underline(words) # Prints the text underlined.
strikethrough(words) # Prints the text strikethrough.
highlight(words) # Highlights the text in whatever bg colour selected.
swap(words) # Swaps the fg / bg colours with each other.
How to use Stylish()
For stylish, set config
s = Stylish()
s.fg = 117
s.bg = 218
# Can do s.it = True etc but the functions below aren't affected by that so they can be used in combination with each others.
Example Usages and Combinations of instances
dogs = ["Max", "Bobby", "Dracula", "Leopold"]
c = Colorful(fg=204, it=True)
c.listme([c.styleme(dog) for dog in dogs])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file manychrome-0.1.0.tar.gz.
File metadata
- Download URL: manychrome-0.1.0.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
831824252559d58d4d2908a62305c1b54c602ad364117392eb8204a6590c5cbc
|
|
| MD5 |
be7c4fbec46b3f1cf226ac60c18fd57d
|
|
| BLAKE2b-256 |
8cc906171eb90e6d956a2b3a3cdbec94fd65fb5e75e016b28eabc616cdec250a
|
File details
Details for the file manychrome-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: manychrome-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ebbb06e1126bec7a1ca5eb9517d62b04e5a3fa520c7ddf066542e22999bd97f0
|
|
| MD5 |
b51356bf9a656a8e2b0c7c32d09bb236
|
|
| BLAKE2b-256 |
25a3479b65b8bcf39eab24c90283572d46ef27a573562b7c75b64563542a34b7
|