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.3

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.3
File Size Uploaded
piecolor-3.2.3.tar.gz 99.2 kB Details

Built distribution (wheel)

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

Total release size: 206.0 kB

Release files / piecolor-3.2.3.tar.gz

Download URL piecolor-3.2.3.tar.gz
Size 99.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b1ccb3b49018b19b2357651b6bc7f9e47dffd4084f9912d3282e424438df238a
BLAKE2b-256 checksum
How to use checksums
470a487d161b1b8a6b1c6fae0ed313009dfec0a5989b438200ee65dc8ca7e3c8
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.3-py3-none-any.whl

Download URL piecolor-3.2.3-py3-none-any.whl
Size 106.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f7b82f19484135daffdfbdd743d052ad5d8e23160aa29cd36374bda2c7bfbca6
BLAKE2b-256 checksum
How to use checksums
2ebd7824232404ba013bb85163f2c0eff2606aee2d1f40bb5fadc6d69b20ef0e
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

This release

3.2.3 This release

2 release files

3.2.2

2 release files

3.2.1

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