termcolor

ANSI color formatting for terminal output in Python

Library
PyPI
v3.3.0
327stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
68/100Good
Development Activity72
Maintenance68
Community52
Maturity60
Momentum20

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
73/100Good
Architecture65
Code Quality80
Innovation55
Learning Curve92

termcolor is a lightweight Python library that adds ANSI color and text-attribute formatting (bold, underline, blink, etc.) to strings printed to a terminal. It exposes a simple colored() function plus a cprint() convenience wrapper around print(), and can also be invoked as a CLI (python -m termcolor) to preview available colors.

Because colorizing terminal output is a near-universal need for CLI tools, test runners, and logging utilities, termcolor is one of the most widely depended-on small utility packages in the Python ecosystem, valued for having effectively zero API surface to learn and no dependencies.

What You Get

  • A colored() function supporting 8 standard foreground/background colors plus “light” variants, and text attributes (bold, dark, underline, blink, reverse, concealed)
  • A cprint() convenience function combining coloring and printing in a single call
  • Automatic color-disabling detection via NO_COLOR and ANSI_COLORS_DISABLED environment variables, and non-TTY output detection
  • A __main__.py CLI entry point (python -m termcolor) that prints a demo of all supported colors and attributes
  • Full type hints and a fully tested, dependency-free implementation

Common Use Cases

  • CLI tools highlighting success/error/warning output in different colors for readability
  • Test runners and linters coloring pass/fail or severity-level output
  • Logging utilities that want colorized log levels without pulling in a heavier logging framework
  • Scripts and build tools that need simple, dependency-free terminal color output across platforms

Under The Hood

Architecture: The library is a single-module implementation (src/termcolor/termcolor.py, 223 lines) exposing colored() and cprint(), backed by dictionaries mapping color/attribute names to ANSI escape codes; __init__.py re-exports the public API and __main__.py implements the python -m termcolor demo CLI. Tech Stack: Pure Python 3.10+ with zero runtime dependencies, packaged via Hatchling with hatch-vcs for version derivation from git tags; pyproject.toml fully declares metadata (no setup.py), and .pre-commit-config.yaml enforces formatting/linting before commits land. Code Quality: tests/test_termcolor.py provides direct unit coverage of the color/attribute combinations and the environment-variable-based disable logic; the codebase is small enough that the entire implementation surface is easily auditable, and CI runs across Python 3.10 through 3.15 per the classifiers in pyproject.toml. API Design: The public API is intentionally minimal — one function to colorize a string, one to colorize-and-print — requiring no configuration or setup, which is precisely why it remains a default choice for adding terminal color without adopting a larger CLI framework.

Used by 6 apps in this directory

Python
90%
Apache 2.0

Apache Airflow

Data Engineering

46,530

Define, schedule, and monitor complex data workflows as Python code — with a powerful UI, 80+ provider integrations, and battle-tested scalability across thousands of production deployments.

View details
96
Repo Health
89
Technical
66
Dependency
Built with
Python90%
Updated today
C++
69%
Apache 2.0

ClickHouse

Databases · Analytics · Data Engineering

49,325

Open-source column-oriented database that delivers real-time analytical queries on petabyte-scale data with millisecond latency.

View details
95
Repo Health
90
Technical
68
Dependency
Built with
C++69%
Python13%
Updated today
TypeScript
94%
Other

OpenHands

AI Code Assistants · AI Development

84,452

The self-hosted developer control center for running AI coding agents — locally, in Docker, on VMs, or across cloud backends — with automation workflows for GitHub, Slack, and more.

View details
91
Repo Health
82
Technical
71
Dependency
Built with
TypeScript94%
Updated today
JavaScript
50%
AGPL 3.0

QRev

CRM · AI Agents

362

Open source AI-first sales platform that replaces Salesforce with autonomous agents handling prospecting, outreach, and lead management at scale.

View details
39
Repo Health
68
Technical
65
Dependency
Built with
JavaScript50%
Python28%
TypeScript14%
Updated 6 months ago
JavaScript
100%
AGPL 3.0

Social Analyzer

Security

23,777

Find and analyze a person's digital footprint across 1000+ social media platforms using multi-layer detection, OCR, and metadata extraction.

View details
43
Repo Health
52
Technical
72
Dependency
Built with
JavaScript100%
Updated 7 months ago
C++
75%
Apache 2.0

Timeplus Proton

Data Engineering · Analytics

2,241

Single C++ binary SQL engine for real-time stream processing, ETL, and analytics on Kafka, Redpanda, and ClickHouse with sub-millisecond latency.

View details
88
Repo Health
82
Technical
73
Dependency
Built with
C++75%
Python11%
Updated 6 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search