Skip to main content

A fluid and lightweight terminal colorizer for Python.

Project description

TermTinty 🎨

A fluid and lightweight terminal colorizer for Python.

TermTinty (the package) brings you Tinty (the tool), a library designed to make your code as elegant as your terminal. Its philosophy is symmetry and fluidity.

from termtinty import Tinty

Why TermTinty?

Most libraries force you to concatenate strings or remember complex constants. Tinty breaks that mold by using a Fluent Interface. This isn't just syntactic sugar; it's a way of programming that prioritizes human readability.

  • 🔗 Fluent Chaining: Chain methods as if you were writing a sentence.
  • 🪶 Ultralight: No dependencies.
  • 🧹 Auto-Reset: State is automatically cleared.
  • 🧘 Zen API: Designed for intuition.

Installation

pip install termtinty

Usage

The Symmetric Pattern

from termtinty import Tinty

t = Tinty() # Instantiate your brush
print(t.CYAN("TermTinty").GREEN(" is ready!"))

🔗 Deep Dive: The Fluent Chain

Method chaining is the heart of TermTinty. Unlike traditional libraries where you sum strings (+), here you transform the flow of information.

Why is it better?

  1. Readability: Reads left-to-right, like English.
  2. Less Noise: Eliminates + operators and intermediate variables.
  3. Context: Logically groups related styles.
# Traditional Style (Hard to read)
# print(Back.RED + Fore.WHITE + "Error:" + Style.RESET_ALL + Fore.YELLOW + " Disk full")

# TermTinty Style (Clean)
print(t.bgRED().WHITE("Error: ").YELLOW("Disk full")) 
# (Note: bgRED has not been implemented but serves as a style example for background colors)

🧠 API Philosophy: Instance vs Static

A common question during the design of this library was: Why t = Tinty() instead of static methods like Tinty.RED()?

The Decision: Object-Oriented for State Management

To achieve true and safe Chaining, we need "memory".

  • If Static (Class.method()): There is no memory between calls. It would be hard to know when to close the color (RESET) or how to accumulate multiple segments (.RED().BLUE()) without returning strange objects.
  • With Instance (obj.method()): The instance t acts as a smart buffer. It accumulates your intentions and knows exactly when to clean itself (Auto-Reset) when printed.

This allows the API to be powerful yet invisible. The user doesn't manage state; Tinty does.

⚔️ Competition and Comparison

How does TermTinty stack up against the giants?

Feature TermTinty Colorama Termcolor Rich
Syntax Fluent (.RED()) Constants (Fore.RED) Functional (colored()) Objects/Tags
Chaining Native & Core Manual (concatenation) Nested (difficult) Via Tags
Auto-Reset Yes (Automatic) Requires autoreset=True Yes Yes
Weight 🪶 Feather Light Light Heavy (Feature-rich)
Focus DX (Developer Exp) Win Compatibility Functional UI Framework

TermTinty is for those who want the syntax power of Rich but the lightness of Colorama.

🚀 Roadmap / TODO

We are actively working on expanding TermTinty. Here is what's coming next:

  • Background Colors: Methods like .bgRED(), .bgBLUE(), etc.
  • Text Styles: Support for BOLD, ITALIC, UNDERLINE, etc.
  • Mixins & Custom Combinations: Create your own reusable styles (e.g., WarningStyle = t.bgYELLOW().RED().BOLD()).
  • RGB / TrueColor: Support for 16 million colors.

Development

Project structure:

termtinty/
├── termtinty/      # Source Code
│   ├── __init__.py
│   └── tinty.py
├── tests/          # Unit Tests
└── pyproject.toml

Tests:

uv add --dev pytest
uv run pytest -vv

🏛️ History and Naming Alternatives

During the conception phase (Branding), multiple identities were evaluated. These alternatives reflect different facets of what TermTinty came to be:

  1. ChromaFlow: ("The Technician") - Emphasized the continuous "flow" of colors. Discarded for sounding too much like a video processing tool.
  2. ChromaChain: ("The Structural") - Literally described the software architecture.
  3. Iris: ("The Mythological") - Reference to the messenger of the gods. Discarded due to PyPI name collision.
  4. Tinty: ("The Chosen One") - Captures the essence: small, friendly, and does one thing well (gives tint).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

termtinty-0.1.0.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

termtinty-0.1.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file termtinty-0.1.0.tar.gz.

File metadata

  • Download URL: termtinty-0.1.0.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for termtinty-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a3fbddfe8afb881b083b92cddf4b341dcdf46d80da5c43d388a9139e31d4af6f
MD5 127cb4e1d4d38b4481b2f8385de1a86d
BLAKE2b-256 d6b869012b6b9d2a052fc11da93cca859d1a9f2ed3df0e252522426542ed3b96

See more details on using hashes here.

File details

Details for the file termtinty-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: termtinty-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for termtinty-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee972238da1e548feff4a71ef74079eaf52505be3f29d3f77c1a88c2c470692a
MD5 d593cf4e3c445823ac777718a027a227
BLAKE2b-256 d6b310c1d32da42221a97d35478091c1c0bf1a33a77b4b339fb1d87bbb74007a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page