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

Metadata

Release files for piecolor 3.2.4

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.4
File Size Uploaded Provenance
piecolor-3.2.4.tar.gz 99.2 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 206.0 kB

Release files / piecolor-3.2.4.tar.gz

Download URL piecolor-3.2.4.tar.gz
Size 99.2 kB
Tags Source
SHA-256 checksum
How to use checksums
1edce8c6b9964afc9d71c470f82ff3805e7f3c34b191fcf219bcddbf8c5f2523
BLAKE2b-256 checksum
How to use checksums
9ffb584f4f8095525d4ff9e5b9b75c90761c1465c339e3e0856bca709cc1b366
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.4-py3-none-any.whl

Download URL piecolor-3.2.4-py3-none-any.whl
Size 106.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dbfc5dbd51a9dd6411e8de6457fcb6d9b154b6b528e60fc514f4f984bb905a0d
BLAKE2b-256 checksum
How to use checksums
a0923816cefe669a322429c3dd81840a054ebfa2b52681a6f2181a43666db0e7
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}

Security for piecolor 3.2.4

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.

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