skillfed

ansi

ANSI cursor movement and graphics

ansi v0.3.7 103.6K downloads/30d#12,799 on PyPI53
Permissive license MIT License DORMANT released

What it is and what it does

ANSI is a small library that wraps ANSI escape codes—the standard sequences terminals use to move the cursor, change text color, apply effects like bold or underline, and control other display attributes. It lets you build styled terminal output by composing color and effect objects, either as a sequence of strings to join or through a functional syntax where colors wrap text as callables.

The package supports standard ANSI colors (foreground and background), text effects (reset, bold, etc.), and 256-color RGB mode for finer color control. It offers both British and American English module names (ansi.colour and ansi.color). With only typing-extensions as a dependency and a pure-Python wheel, it installs with minimal friction and works on any Python 3.6+ environment with a terminal that understands ANSI codes.

Use it for:

  • Add colored and styled output to CLI tools and scripts without external dependencies.
  • Build terminal-based user interfaces with cursor positioning and text effects.
  • Highlight errors, warnings, and status messages in console applications.
  • Generate colored log output for debugging and monitoring scripts.
  • Create visually distinct sections in terminal reports or data displays.

Worth the install?

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

Provides ANSI escape codes for cursor movement and text styling (colors, effects) in terminal output, with support for 256 RGB colors and both British and American English naming.

Yes, if you need ANSI terminal styling in a CLI tool or script. The package is lightweight, has no security issues, and carries a permissive license. Its dormant maintenance is not a blocker for stable, narrow functionality like ANSI code generation, but verify that the codes work reliably with your target terminals before relying on it for critical output.

Install

ansi on PyPI

pip

pip install ansi

uv

uv add ansi

poetry

poetry add ansi

Installing ansi

Before you install

Low friction: pure Python wheel with only typing-extensions as a runtime dependency. Dormant maintenance (last commit 2024-01-22, 935 days since release), but repository is not archived and has seen recent activity.

License in practice

MIT License permits commercial and private use with minimal restrictions; you may use, modify, and distribute the package freely provided you retain the license notice.

Quickstart

pip install ansi

from ansi.colour import fg, bg
from ansi.colour.fx import reset

msg = (bg.red, fg.yellow, 'Hello world!', reset)
print(''.join(map(str, msg)))

Requires Python 3.6 or later; terminal must support ANSI escape sequences for colors and effects to render.

Verify before relying

  • Whether the package is actively maintained or if dormancy signals upcoming deprecation
  • Compatibility with modern terminal emulators and whether all ANSI codes work reliably across platforms

Package facts

License MIT License (permissive)
Python support supports the current Python release (>=3.6)
Install friction low — pure-Python wheel
Runtime dependencies 1 — typing-extensions
Maintenance dormant — 935 days since the last release
Last repo commit
First released
Downloads 103,553/month — #12,799 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ansi-0.3.7-py3-none-any.whl

Tags

ansi escape codes terminalcolored text console outputterminal cursor movementansi color codes python256 rgb terminal colorsterminal text stylingansi graphics codes
terminal-stylingansi-codes

More Terminals packages