Skip to main content

A Python module for easily applying ANSI codes in a terminal.

Project description

ANSI Codes

A Python module to handle ANSI escape codes for terminal control, providing features for cursor movement, text formatting, and color manipulation.

Features

  • Move the cursor to specific positions or manipulate its location.
  • Change text appearance (bold, italic, underline, etc.).
  • Apply 16, 256, and true color (24-bit) to text and backgrounds.
  • Clear parts of the terminal (lines, screen, etc.).

Installation

You can install the package using pip:

pip install mansi

Usage

from mansi import Cursor, Color, Font, Erase

Cursor.home()
Erase.all()
Color.c16('brightred')
Font.bold()
print("Hello, World!")

Color.reset()

Cursor

The Cursor class moves the terminal cursor around:

Cursor.moveRight(10)
Cursor.moveDown(5)

Font

The Font class formats terminal text:

Font.underline()
print("This text is underlined.")
Font.underline(False)

Color

The Color class sets colors in the terminal:

Color.c16('green')       # 16-color
Color.c256(82)           # 256-color
Color.c24bit(255, 0, 0)  # TrueColor (24-bit)

Erase

The Erase class clears parts of the terminal:

Erase.all()            
Erase.currentLine()    

Contributions

Contributions are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mansi-1.0.2.tar.gz (1.9 kB view details)

Uploaded Source

Built Distribution

mansi-1.0.2-py3-none-any.whl (1.7 kB view details)

Uploaded Python 3

File details

Details for the file mansi-1.0.2.tar.gz.

File metadata

  • Download URL: mansi-1.0.2.tar.gz
  • Upload date:
  • Size: 1.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for mansi-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b82f8339909c8ced4f51c6c1f16a570c2991dfceeabb3de9cf6a9024fb311b9f
MD5 cec55f2f5268fcbf2d414a17fd718f3e
BLAKE2b-256 795c4456b379eaaf28db12e953ffddbd7a2077f15e8ad623140d60a6c2e49b31

See more details on using hashes here.

File details

Details for the file mansi-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: mansi-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 1.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for mansi-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bdc5e38236e468c8bf5201aaed7afb4e0601114f4ec92d75781ddf839c773a9f
MD5 16bffd168d367fd9a3efac36bd47c129
BLAKE2b-256 c15da46a227bfed1871733bceacddfe6b0689948b9757926445abadcea8fe5de

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page