Skip to main content

format_printing

A Python library for rich, styled terminal output — colors, gradients, tables, spinners, progress bars, and more. Works as a drop-in replacement for Python's built-in print and input.

pip install format_printing

Features

  • Colored and styled text (bold, italic, underline, strikethrough, dim)
  • Named colors, hex colors, and RGB tuples
  • Gradient text (per-character color blending)
  • Bordered boxes
  • Auto-sized tables from dicts or lists
  • Clickable terminal hyperlinks
  • Typewriter effect printing
  • Spinner animations (context manager or function-wrapping)
  • Progress bars (function-wrapping or fixed-duration)

Quick Start

from format_printing import print, print_box, print_gradient, spinner, progress_bar

Colors

Colors can be passed as:

  • A named string: "red", "cyan", "neon_pink", "gold", etc.
  • A hex string: "#ff6600"
  • An RGB tuple: (255, 100, 0)

Built-in named colors: red, orange, yellow, green, blue, indigo, violet, black, white, brown, grey / gray, cyan, magenta, neon_pink, gold, crimson


API Reference

print(*args, color, bg, bold, dim, italic, underline, strikethrough)

Drop-in replacement for the built-in print. Accepts all standard print keyword arguments.

from format_printing import print

print("Hello, world!", color="cyan", bold=True)
print("Warning!", color="#ff6600", bg="black", underline=True)
print("Soft text", dim=True)

print_type(*args, color, bg, bold, dim, italic, underline, strikethrough, delay)

Prints text character by character with a typewriter effect.

from format_printing import print_type

print_type("Loading complete.", color="green", delay=0.05)
Param Default Description
delay 0.03 Seconds between each character

input(prompt, color, bg, bold, dim, italic, underline, strikethrough)

Drop-in replacement for the built-in input with styled prompts.

from format_printing import input

name = input("Enter your name: ", color="yellow", bold=True)

clear()

Clears the terminal screen.

from format_printing import clear

clear()

print_box(*args, color, border_color, bold, dim, italic, padding)

Prints text inside a Unicode bordered box.

from format_printing import print_box

print_box("Operation complete!", color="green", border_color="cyan", padding=2)
Param Default Description
padding 1 Horizontal padding inside the box

print_gradient(*args, start, end)

Prints text with a smooth per-character color gradient.

from format_printing import print_gradient

print_gradient("Rainbow text!", start="red", end="blue")
print_gradient("Sunset vibes", start="#ff6600", end="#ffcc00")

print_dual_gradient(*args, text_start, text_end, bg_start, bg_end)

Prints text with independent gradients for both foreground and background.

from format_printing import print_dual_gradient

print_dual_gradient("Fancy!", text_start="white", text_end="yellow", bg_start="blue", bg_end="magenta")

print_table(data, border_color, header_color)

Prints an auto-sized, aligned table. Accepts a list of dicts or a list of lists (first row = headers).

from format_printing import print_table

# From dicts
data = [
    {"Name": "Alice", "Role": "Engineer", "Level": "Senior"},
    {"Name": "Bob",   "Role": "Designer", "Level": "Mid"},
]
print_table(data, border_color="grey", header_color="cyan")

# From lists
data = [
    ["Name", "Score"],
    ["Alice", "98"],
    ["Bob",   "87"],
]
print_table(data)

print_link(text, url, color, bold, underline)

Prints a clickable hyperlink (supported in most modern terminals).

from format_printing import print_link

print_link("Visit PyPI", "https://pypi.org", color="cyan", bold=True)

loading_context(message, color, done)

A context manager that shows a spinner while a block of code runs.

from format_printing import loading_context
import time

with loading_context("Fetching data", color="cyan", done="Data loaded!"):
    time.sleep(2)
Param Default Description
message "Processing" Text shown next to the spinner
color "cyan" Spinner color
done "Done!" Message shown on completion

spinner(message, fn, *args, duration, spinner_color, color, done, **kwargs)

Two modes:

Fixed duration — spins for a set number of seconds:

from format_printing import spinner

spinner("Warming up", duration=2.0, spinner_color="magenta")

Function-wrapping — spins until a function finishes, then returns its result:

from format_printing import spinner
import time

def fetch_data(url):
    time.sleep(2)
    return {"status": "ok"}

result = spinner("Fetching", fetch_data, "https://example.com", done="Fetched!")
print(result)
Param Default Description
duration 2.0 Seconds to spin (fixed mode only)
spinner_color "cyan" Color of the spinner character
color None Color of the message text
done "Done!" Completion message

progress_bar(fn, *args, message, bar_color, bracket_color, text_color, length, duration, done, **kwargs)

Two modes:

Fixed duration — fills the bar over a set number of seconds:

from format_printing import progress_bar

progress_bar(duration=3.0, message="Installing", bar_color="green")

Function-wrapping — fills the bar while a function runs:

from format_printing import progress_bar
import time

def process():
    time.sleep(3)
    return "finished"

result = progress_bar(process, message="Processing", done="Complete!")
print(result)
Param Default Description
message "Processing" Label shown next to the bar
bar_color "green" Color of the filled portion
bracket_color "grey" Color of the [ ] brackets
text_color None Color of the message text
length 20 Width of the bar in characters
duration 3.0 Seconds to fill (fixed mode only)
done "Done!" Completion message

License

MIT License — see LICENSE for details.

Metadata

Release files for format-printing 0.1.0

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

Source distribution (sdist)

Source distribution for format-printing 0.1.0
File Size Uploaded Provenance Actions
format_printing-0.1.0.tar.gz 6.8 kB Without provenance Details for format_printing-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for format-printing 0.1.0
File Interpreter ABI Platform Actions
format_printing-0.1.0-py3-none-any.whl Python 3 none any Details for format_printing-0.1.0-py3-none-any.whl

Total release size: 14.7 kB

Release files / format_printing-0.1.0.tar.gz

Download URL format_printing-0.1.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
07f26589662af244a6775e7eea509cf40becb9e38b9a6e1df433097166802274
BLAKE2b-256 checksum
How to use checksums
c9f5a24339a7b1d69422465238cba131a6f57fb88335299d66fbcf7dca742c44
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / format_printing-0.1.0-py3-none-any.whl

Download URL format_printing-0.1.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b92e881812d265d2825dc84a50762b7adaddc580f213d6bdc258a3adb32236b
BLAKE2b-256 checksum
How to use checksums
8a138c056fcf76736f857e1bfd31d2478e0d0a11e2e867ecdaa2a016ccf5d8a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Security for format-printing 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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