colorclass
Colorful worry-free console applications for Linux, Mac OS X, and Windows.
What it is and what it does
colorclass is a library for adding ANSI color codes to console text in Python, with built-in support for automatic color selection based on terminal background brightness. It works by subclassing str (Python 3.x) or unicode (Python 2.x) and provides tag-based syntax like {red}text{/red} to mark colored regions. The library includes platform-specific initialization—Windows.enable() for Windows, set_light_background() or set_dark_background() for Linux/macOS—to enable automatic color detection and adjustment.
The package is designed for developers building command-line applications that need portable, readable color output across different terminal environments. It handles the complexity of terminal capability detection and provides helper attributes to access both colored and plain-text versions of strings. However, the project is archived and unmaintained since 2021-12-09, with no active development or security updates.
Use it for:
- Add colored output to CLI tools and scripts that run on multiple platforms without manual ANSI code management.
- Build terminal-based applications that automatically adapt text colors to dark or light terminal backgrounds.
- Pipe colored or ANSI-coded text through Python for processing, stripping, or forcing color output via environment variables.
- Create cross-platform shell utilities in Python that display error/warning/success messages in distinct colors.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides ANSI color text output for console applications with automatic color selection based on terminal background (dark or light) across Linux, macOS, and Windows.
Yes, if you need basic ANSI color support in a stable, mature codebase and can accept no further maintenance. The library is production-stable and has no known vulnerabilities, but its abandonment since 2021-12-09 means no fixes for future Python versions or terminal changes. For new projects, consider actively maintained alternatives; for existing codebases already using it, the low install friction and lack of dependencies make it safe to keep.
Install
colorclass on PyPI
pip
pip install colorclassuv
uv add colorclasspoetry
poetry add colorclassInstalling colorclass
Before you install
Installation is straightforward with no runtime dependencies. However, the package is archived and abandoned—last release was 2021-12-09, with no active maintenance or security updates expected.
License in practice
MIT license permits free use, modification, and distribution with minimal restrictions, making it safe for commercial and open-source projects.
Quickstart
pip install colorclass
from colorclass import Color
color_string = Color('{red}Test{/red}')
print(color_string)
On Windows, call Windows.enable() before using colors; on Linux/macOS, call set_light_background() or set_dark_background() to toggle auto-colors.
Verify before relying
- Whether the package still works reliably with Python 3.10+ despite being abandoned since 2021.
- Whether Windows 10+ ANSI support mentioned in the description is fully functional without Windows.enable().
- Active community forks or maintained alternatives that may have addressed issues since abandonment.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=2.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,709 days since the last release |
| Last repo commit | (repository archived) |
| First released | |
| Downloads | 9,103,576/month — #1,562 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: colorclass-2.2.2-py2.py3-none-any.whl
Keywords: Shell, Bash, ANSI, ASCII, terminal, console, colors, automatic
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
coloredColored provides ANSI/VT100 escape sequences…
permissive · top 5,000 on PyPI
colorthiefExtracts dominant colors and color palettes…
permissive · top 15,000 on PyPI
python-printrProvides enhanced print functions that format…
unclear · top 15,000 on PyPI
ansiconEnables ANSI color and style codes in Windows…
copyleft · top 15,000 on PyPI
termcolorAdds ANSI color and text formatting (bold,…
permissive · top 1,000 on PyPI
ansicolorsEmbeds ANSI color and style codes into Python…
permissive · top 5,000 on PyPI
crayonsCrayons provides colored text output for…
permissive · top 15,000 on PyPI
coloramaColorama makes ANSI escape sequences for…
permissive · top 100 on PyPI
colorfulColorful applies ANSI color and text styling to…
permissive · top 5,000 on PyPI
coloredlogsAdds colored output to Python's standard…
permissive · top 1,000 on PyPI