Skip to content

oliverjane/PyANSI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyANSI

PyANSI provides an easy way to use ANSI escape codes to control the colour and cursor of a terminal.

System Requirements

PyANSI is primarily intended for Unix-like operating systems but will run on any operating system which supports ANSI escape codes.

Note: Windows users may need to initialise the console using PyANSI.windows.init()

Install

Install using pip:

pip install PyANSI

Examples

Colour

Note: The colours and colors submodules are functionally identical but the colors submodule uses the American spelling of color instead of colour.

True Colour

from PyANSI import colours
colours.printHex("Hello, World!", foreHex="#00AEFF", backHex="#FF5500")

ANSI 256 Colour Mode

from PyANSI import colours
colours.print256("Hello, World!", foreColour=32, backColour=172)

Cursor Control

Show/hide the cursor

from PyANSI import cursor
cursor.hide()
cursor.show()

Move the cursor

from PyANSI import cursor
cursor.move.left(10)
cursor.move.right(10)
cursor.move.up(10)
cursor.move.right(10)

Jump to home

from PyANSI import cursor
cursor.home()

About

Simple ANSI control for Python.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages