ANSI cursor movement and graphics
Project description
ANSI
Various ANSI escape codes, used in moving the cursor in a text console or rendering coloured text.
Example
Print something in bold yellow on a red background:
>>> 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)))
...
If you like syntactic sugar, you may also do:
>>> from ansi.colour import fg, bg
>>> print(bg.red(fg.yellow('Hello world!')))
...
Also, 256 RGB colours are supported:
>>> from ansi.colour.rgb import rgb256
>>> from ansi.colour.fx import reset
>>> msg = (rgb256(0xff, 0x80, 0x00), 'hello world', reset)
>>> print(''.join(map(str, msg)))
...
If you prefer to use American English instead:
>>> from ansi.color import ...
References
https://www.ecma-international.org/publications-and-standards/standards/ecma-48/
Requirements
Ansi requires python 3.6 and supports typing.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ansi-0.3.7.tar.gz
(7.9 kB
view details)
Built Distribution
ansi-0.3.7-py3-none-any.whl
(9.0 kB
view details)
File details
Details for the file ansi-0.3.7.tar.gz
.
File metadata
- Download URL: ansi-0.3.7.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7e59108922259e03c54e4d93fc611bba0e756513086849708b86b6c80f8d4cd4 |
|
MD5 | 3a481a60390c5edf3b31f74057d37d57 |
|
BLAKE2b-256 | ed589444d8e465858ae9cb2096aa48236ab5760ea9dbaac58e609f3b461776de |
File details
Details for the file ansi-0.3.7-py3-none-any.whl
.
File metadata
- Download URL: ansi-0.3.7-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdd9e3c2dc3e4c8df8c2b745ca6f07f715aa4edee5ed4a5bcb29065da06a3f71 |
|
MD5 | aa4830b46aae034f2a1db25b1239beef |
|
BLAKE2b-256 | 0e448244b092c39aa39cb61afcb5d64f4a2a22bf9ab291d5f689a9406d158d04 |