Skip to main content

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.

Metadata

Release files for ansi 0.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ansi 0.3.7
File Size Uploaded
ansi-0.3.7.tar.gz 7.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ansi 0.3.7
File Interpreter ABI Platform
ansi-0.3.7-py3-none-any.whl Python 3 none any Details

Total release size: 16.9 kB

Release files / ansi-0.3.7.tar.gz

Download URL ansi-0.3.7.tar.gz
Size 7.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7e59108922259e03c54e4d93fc611bba0e756513086849708b86b6c80f8d4cd4
BLAKE2b-256 checksum
How to use checksums
ed589444d8e465858ae9cb2096aa48236ab5760ea9dbaac58e609f3b461776de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release files / ansi-0.3.7-py3-none-any.whl

Download URL ansi-0.3.7-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bdd9e3c2dc3e4c8df8c2b745ca6f07f715aa4edee5ed4a5bcb29065da06a3f71
BLAKE2b-256 checksum
How to use checksums
0e448244b092c39aa39cb61afcb5d64f4a2a22bf9ab291d5f689a9406d158d04
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release history Release notifications | RSS feed

This release

0.3.7 This release

2 release files

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page