Skip to main content

a simple library to generate ANSI escape sequences

Project description

ansiterm Package

ansiterm - a simple library to generate ANSI escape sequences

DESCRIPTION

This manual page documents ansiterm module, a Python module providing functions for generating ANSI escape sequences.

A majority of terminal emulators support ANSI escape sequences. ansiterm module provides a very limited set of functions for changing the color and the style of the characeters displayed on the screen.

Please refer to https://en.wikipedia.org/wiki/ANSI_escape_code for the introduction of ANSI escape sequences.

EXAMPLE

from ansiterm import color

for bold in (False, True):
    for reverse in (False, True):
        for name in [
                'reset', 'bold', 'underline', 'reverse', 'gray', 'red',
                'green', 'yellow', 'blue', 'magenta', 'cyan', 'white'
        ]:
            astr = color('text in {} with bold={}, reverse={}'.format(
                name, bold, reverse),
                         name,
                         bold=bold,
                         reverse=reverse)
            print(astr)

FUNCTIONS

ansiterm module provides the following functions.

  • color(astr, name='bold', bold=False, reverse=False)

    Embed ANSI escape sequences around string ASTR to change the text style to NAME. Make the text boldface and reversed video if BOLD or REVERSE is True, respectively.

The following functions are provided as short-cuts.

  • reset(astr, bold=False, reverse=False)

  • bold(astr, bold=True, reverse=False)

  • gray(astr, bold=False, reverse=False)

  • red(astr, bold=False, reverse=False)

  • green(astr, bold=False, reverse=False)

  • yellow(astr, bold=False, reverse=False)

  • blue(astr, bold=False, reverse=False)

  • magenta(astr, bold=False, reverse=False)

  • cyan(astr, bold=False, reverse=False)

  • white(astr, bold=False, reverse=False)

INSTALLATION

pip3 install ansiterm

AVAILABILITY

The latest version of ansiterm module is available at PyPI (https://pypi.org/project/ansiterm/) .

SEE ALSO

perl(1), perlfunc(1), getopt(3), Getopt::Std(3perl)

AUTHOR

Hiroyuki Ohsaki <ohsaki[atmark]lsnl.jp>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ansiterm-1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ansiterm-1.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file ansiterm-1.0.tar.gz.

File metadata

  • Download URL: ansiterm-1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for ansiterm-1.0.tar.gz
Algorithm Hash digest
SHA256 e49217fb5da8149f313f84353967d73cb21933fbde639f3fed656ada1dea1231
MD5 1aba46944d4fe04acef5ded5cc3f2a61
BLAKE2b-256 cfafc0f410d06536c047f1e4e2438d4ad13993582ef6595c68bd35064fd803f7

See more details on using hashes here.

File details

Details for the file ansiterm-1.0-py3-none-any.whl.

File metadata

  • Download URL: ansiterm-1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for ansiterm-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de96313701f4be6f10fea4d1caee66a07674929cee9d26d14d37700b5f8d65aa
MD5 bbcc3d6ecfea34289b131877e07896c7
BLAKE2b-256 7aabcd31f939c625d2ddc772a451741eee5d1c7b34a0a05c0266976cf729c8de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page