skillfed

colorclass

Colorful worry-free console applications for Linux, Mac OS X, and Windows.

colorclass v2.2.2 9.1M downloads/30d#1,562 on PyPI6
Permissive license MIT Abandoned released

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 colorclass

uv

uv add colorclass

poetry

poetry add colorclass

Installing 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

Development Status :: 5 - Production/StableEnvironment :: ConsoleEnvironment :: MacOS XEnvironment :: Win32 (MS Windows)Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: POSIX :: LinuxProgramming Language :: Python :: 2Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: LibrariesTopic :: TerminalsTopic :: Text Processing :: Markup

Tags

ansi color terminal outputcolored console textterminal color libraryauto-detecting terminal colorscross-platform console colorscolored text printingterminal background detection
ansi-colorscli-outputabandoned

More Libraries packages