skillfed

ansicolors

ANSI colors for Python

ansicolors v1.1.8 12.8M downloads/30d#1,304 on PyPI35
Permissive license ISC Abandoned released

What it is and what it does

ansicolors is a lightweight library that wraps strings with ANSI escape sequences to add foreground color, background color, and text styling (bold, underline, etc.) for display in terminal emulators. It offers multiple ways to specify colors: 8 basic ANSI names (black, red, green, yellow, blue, magenta, cyan, white), 256-color xterm palette by integer index (0-255), or 24-bit RGB via tuple, CSS color name, hex string, or RGB notation. The library also provides utility functions to strip ANSI codes from styled strings and compute their effective length.

The package has no runtime dependencies and installs as a pure Python wheel, making it trivial to add to any project. However, it is abandoned—the last release was in 2017, and the repository has not been updated since 2022. While the core functionality remains stable and works on modern Python versions, no maintenance or fixes will be forthcoming. Terminal support for ANSI codes varies widely; the library will emit the codes regardless, but not all terminals render all colors and styles accurately.

Use it for:

  • Colorize CLI tool output (error messages in red, success in green) for better user readability.
  • Highlight specific log entries or warnings in terminal-based monitoring or debugging scripts.
  • Create styled prompts or status messages in interactive command-line applications.
  • Generate colored output for test runners or build tool summaries to distinguish pass/fail/skip states.
  • Add visual emphasis to data dumps or formatted text in terminal-based data inspection tools.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Embeds ANSI color and style codes into Python strings for colored terminal output, supporting 8 basic colors, 256-color xterm palette, 24-bit RGB, and CSS color names.

Yes, if you need simple ANSI coloring in a CLI tool and accept that the package will not be maintained. The library is stable, dependency-free, and widely used (top 5000 on PyPI). Do not use it if you require active maintenance, Python 2 support, or advanced terminal control beyond basic colors and styles. For new projects, consider whether a more actively maintained alternative better suits your risk tolerance.

Install

ansicolors on PyPI

pip

pip install ansicolors

uv

uv add ansicolors

poetry

poetry add ansicolors

Installing ansicolors

Before you install

Installation is frictionless—a pure Python wheel with no runtime dependencies. However, the package is abandoned: last release was 2017-06-02, over 3360 days ago, with no commits since 2022-08-18. It still works for basic use but will not receive bug fixes or updates.

License in practice

Licensed under ISC (permissive), which allows commercial and private use with minimal restrictions. No notable licensing barriers to adoption.

Quickstart

pip install ansicolors
from ansicolors import color
print(color('my string', fg='blue'))
print(color('some text', fg='red', bg='yellow', style='underline'))

Verify before relying

  • Whether the package's Python 2 support (2.6, 2.7) and older Python 3 versions (3.3–3.6) remain relevant for your use case, given Python 2 EOL.
  • Terminal/device compatibility: the description notes fragmented ANSI support across terminals—verify your target environment handles the colors and styles you need.

Package facts

License ISC (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 3,360 days since the last release
Last repo commit
First released
Downloads 12,803,460/month — #1,304 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ansicolors-1.1.8-py2.py3-none-any.whl

Keywords: ASNI, color, style, console

Environment :: ConsoleIntended Audience :: DevelopersLicense :: OSI Approved :: ISC License (ISCL)Operating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2Programming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: 3.6Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Libraries :: Python Modules

Tags

ANSI color codes Pythonterminal colored textconsole output stylingRGB color terminalxterm 256 colorstext decoration ANSIcolored strings Python
cli-outputterminal-stylingabandoned

More Python Modules packages