Skip to main content

piecolor

Series of tools for python3, releasing to PyPi.

# Install for Testing
# System
/usr/bin/python3 -m pip install -e .
# brew
python3 -m pip install -e .

This package currently includes 4 different libraries: - A text coloring library, along with argparse colorization (counts as 2). - A process listing library (ala ps which does NOT work in Windows). - A set of routines to pull methods and instance variables from one class into another.

Terminal Colors

Probably most of most interest: the text coloring and color argparse libraries.

import  piecolor.term.colors as c
import  piecolor.script.argparse_color as ColorArgparse

The focus here is on simplicity and readability. Instead of cumbersome escape codes, cumbersome color names and the overall cumbersomeness of using color, it's as easy as the proverbial pie.

The colors library includes five palettes. They can be used individually, or mixed and matched in the same code.

The first three palettes provide different common naming conventions for the xterm 256 color palette.

The first 8 base colors all have single-letter counterparts from RGB and CMYK. The delimiter, system and solarized palettes include similarly abbreviated color names. This makes coloring text a lot nicer looking in code.

R - red G - green B - blue C - cyan M - magenta Y - yellow K - black W - white N - reset to system normal

Preceding each with 'X' (for "extended" colors) takes us to the 16-color palette.

XR - extended red XG - extended green etc.

The Solarized palette includes the exact same 16-color naming, though each color name represents an different actual color. It also includes the violet, orange and the special names invented for Solarized itself. Solarized has a mild, Matrix-like green tint.

V - violet O - orange b03 - base03 b02 - base02 b01 - base01 b00 - base00 b0 - base0 b1 - base1 b3 - base3 b2 - base2

Note that we can code coloring in two ways: with methods or with instance variables. The methods use lower case names while the variables use upper_case names. The methods always reset the color back to "normal" (no color), while the instance variables work better when setting multiple colors in text.

Palettes

  • ANSI The common "ANSI" standard color names.
import  piecolor.term.colors as c

print("I'm so mad, I'm seeing", c.ansi.r("red!"))
print("Better than being," c.ansi.y("yellow"), "with envy")

ca = c.ansi # a bit of abbreviating
print(ca.R + "Happy", ca.W + "Fourth", ca.B + "of July" + ca.N)
  • SOLARIZED
import  piecolor.term.colors as c

print(c.sol.b01("A greyscale-ish color named base01!"))
  • X11 These names come from the X11 'rgb.txt' file found on many systems. They overlap heavily with the ANSI palette, but some names may appear only one or the other, and some which do match may actually have slightly different color values.
import  piecolor.term.colors as c

print(c.x11.chocolate("I love chocolate!"))
  • SYSTEM Colorization for common system terms, akin to color ls.

e - exe cmd - command f - file d - dir or even directory l - link mp - mount h - hostname u - username

  • Delimiters A word of wisdom: colorizing delimiters looks really great, but are a huge hassle. This palette doesn't just change the color: it inserts the actual colorized delimiters as well. These only exist as functions, and typically work best for double-delimiaters like '()' etc.
print("We use the html tag", c.dlm.angle("p"), "for paragraphs)
print("A graph starting at", c.dlm.coord(1, 2))

Release files for piecolor 3.2.1

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

Source distribution (sdist)

Source distribution for piecolor 3.2.1
File Size Uploaded
piecolor-3.2.1.tar.gz 97.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for piecolor 3.2.1
File Interpreter ABI Platform
piecolor-3.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 202.1 kB

Release files / piecolor-3.2.1.tar.gz

Download URL piecolor-3.2.1.tar.gz
Size 97.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d93f5685da574f79dfe31c2d309f585d517b51c61260b0421fa1ff39e1c58f98
BLAKE2b-256 checksum
How to use checksums
c4bd499f83736fb5a5041d21126416908f6a60d2cd0b3c6172501ab0ab6bb665
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / piecolor-3.2.1-py3-none-any.whl

Download URL piecolor-3.2.1-py3-none-any.whl
Size 104.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ea0f75cd0f0f835ea251b6e11539adaf3f84c60e175a241ef5f285e1d23f013
BLAKE2b-256 checksum
How to use checksums
c92ec870fea61b37f9f47acad32a52be264fe5b5ec7f269c4b11b7189f5bfb8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

3.2.2

2 release files

This release

3.2.1 This release

2 release files

3.2.0

2 release files

3.1.1

2 release files

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