A Python module to handle ANSI escape codes for terminal control, providing features for cursor movement, text formatting, and color manipulation.
- 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.).
You can install the package using pip:
pip install mansifrom mansi import Cursor, Color, Font, Erase
Cursor.home()
Erase.all()
Color.c16('brightred')
Font.bold()
print("Hello, World!")
Color.reset()The Cursor class moves the terminal cursor around:
Cursor.moveRight(10)
Cursor.moveDown(5)The Font class formats terminal text:
Font.underline()
print("This text is underlined.")
Font.underline(False)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)The Erase class clears parts of the terminal:
Erase.all()
Erase.currentLine() Contributions are welcome!