pintar
A Python library for flexible terminal text coloring using ANSI escape codes.
Installation
pip install pintar
Quick Start
Color text with dye
from pintar import dye, RGB
# Foreground color with hex
text = dye("Hello world", "#FF5733")
print(text)
# Foreground and background
text = dye("Warning", fore="#FFFFFF", bg="#FF0000")
print(text)
# With style
text = dye("Bold text", fore="cyan", style="bold")
print(text)
Color text with pstr (tag syntax)
from pintar import pstr
pstr("[red]Red text[/]")
pstr("[bold][#FF5733]Bold orange[/][/]")
pstr("[green]Green on [on blue]blue background[/][/green]")
Reusable coloring with Brush
from pintar import Brush
red_bold = Brush.load(fore="#FF0000", style="bold")
print(red_bold("This text is red and bold"))
Color a substring with Stencil
from pintar import Stencil
s = Stencil("Hello cruel world", start=6, end=11)
print(s.spray(fore="#00FF00"))
Custom colors
from pintar import RGB, HSL, HEX
c1 = RGB(255, 128, 0)
c2 = HSL(210, 1.0, 0.5)
c3 = HEX("#3498db")
text = dye("Custom color", c1)
print(text)
256-color palette
from pintar import dye
dye.palette()
Supported color formats
| Format | Example |
|---|---|
| Hex string | "#FF5733" |
| Short hex | "#F00" |
| RGB tuple | (255, 0, 0) |
| RGB object | RGB(255, 0, 0) |
| HSL object | HSL(0, 1.0, 0.5) |
| HEX object | HEX("#FF0000") |
| ANSI index | 196 |
Available styles
bold, italic, underline, strikethrough. Combine with +: "bold+italic".
License
MIT
Metadata
Release files for pintar 0.7.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pintar-0.7.3.tar.gz | 18.2 kB | Without provenance | Details for pintar-0.7.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pintar-0.7.3-py3-none-any.whl | Python 3 | none | any | Details for pintar-0.7.3-py3-none-any.whl |
Total release size: 39.0 kB
Release files / pintar-0.7.3.tar.gz
| Download URL | pintar-0.7.3.tar.gz |
|---|---|
| Size | 18.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21bf359fa3dac615e350c4cce1c25518b237aab2c843650bf0937f3729ae98bb
|
|
BLAKE2b-256 checksum How to use checksums |
00052dbd62b5ef25826ed8ceefbce29fb7f6b2ab53e047f54b7763f99f2a5211
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Release files / pintar-0.7.3-py3-none-any.whl
| Download URL | pintar-0.7.3-py3-none-any.whl |
|---|---|
| Size | 20.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f2717b0c6700345e1b36f8acac329ec087023ffae3cb4db8d542264eacb6a091
|
|
BLAKE2b-256 checksum How to use checksums |
86720b960cb69be3f07c224e8dacf4a524819b9a436ae6e4c95792d1b80cb824
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.13
|
Security for pintar 0.7.3
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.