Skip to main content

ANSI escape sequences to format printed strings

Project description

AnsiFmt

ANSI escape sequences to format strings that are printed to terminal.

Usage

import AnsiFmt as fmt

string = "Hello, world"

# Print the string with underline
print(fmt.underline(string))

# Set it to have red background
print(fmt.bg(string, 1))

# Color can be either an integer, a hex color string or a tuple of (red, green, blue)
print(fmt.fg(string, '#3cde2f'))

# Formats can be nested since each function returns a formatted string
print(fmt.bg(fmt.fg(fmt.bold(string), 4), 15))

preview

Functions

  • bg(str, color)
  • fg(str, color)
  • blink(str)
  • bold(str)
  • dim(str)
  • double_underline(str)
  • hide(str)
  • invert(str)
  • italic(str)
  • overline(str)
  • strike(str)
  • underline(str)

color can either be an integer of ANSI color codes, a hex color string, or a tuple of (red, green, blue) values.

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

ansifmt-0.1.0.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

ansifmt-0.1.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file ansifmt-0.1.0.tar.gz.

File metadata

  • Download URL: ansifmt-0.1.0.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.3

File hashes

Hashes for ansifmt-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d318460484706295746260334857919ecef68175fe181764603d011401a5cfef
MD5 480825cf2105389e0e87ccea0d6423bd
BLAKE2b-256 b2afb474ff58086bbfd9e797bdd1d8c7588759f1c26e21d9c92931e7cb3aabe6

See more details on using hashes here.

File details

Details for the file ansifmt-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ansifmt-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.3

File hashes

Hashes for ansifmt-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 be067f60f86e8e3bec7b414be3f1fcd5d2d029aae2df3f70c7c6d2d328e34fb2
MD5 fc1d45561301787faaadc48f6648347d
BLAKE2b-256 4f678372015529e6ad7c3215b9bd883dff5174062458b2dd1f84c81506934e6b

See more details on using hashes here.

Supported by

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