Skip to content

gallium-gonzollium/mansi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

mANSI

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!

About

Python module for easily applying ANSI codes.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages