Skip to main content

Text stylizer mainly for CLI output.

Project description

fortext

Text stylizer for Python. Mainly useful for CLI output.

Table of Contents

Installation

Use pip to install fortext.

python3 -m pip install --upgrade fortext

Usage

Text styling

from fortext import style, Bg, Frmt
print(style('Hi, human.', fg='#ff0000'))
print(style('RGB tuple or list also works.', fg=(0, 255, 0)))
print(style('You can also use predefined colors.', bg=Bg.BLACK))
print(style('Want to be bold?.', frmt=[Frmt.BOLD]))

print(
    style('Want to go all in?',
          fg='#ff0000', bg=Bg.BLACK,
          frmt=[Frmt.BOLD, Frmt.UNDERLINE, Frmt.ITALIC]))

The style function respects the NO_COLOR environment variable. This behavior can be disabled by setting force_color=True.

Print all styles

from fortext import print_styles_all
print_styles_all()

Syntax highlighting

from fortext import highlight
print(highlight({'somekey': 'somevalue', 'anotherkey': [12.4, True, 23]}))

Output:

syntax highlighting output

String permutations

from fortext import permutations
for perm in permutations('abc'):
    print(perm)

Output:

a
b
c
ab
ac
ba
bc
ca
cb
abc
acb
bac
bca
cab
cba

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

fortext-2.0.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

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

fortext-2.0.0-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file fortext-2.0.0.tar.gz.

File metadata

  • Download URL: fortext-2.0.0.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for fortext-2.0.0.tar.gz
Algorithm Hash digest
SHA256 6129ce67c77d42db522812942859ee106e17d4eb382ebf090098bae0413b429e
MD5 b4372a90fe996c1ed6984714c338ef22
BLAKE2b-256 2ee01c47f4410938c6ef676f5af3961bc09ba49ad610a788f8d665e1752e3ba2

See more details on using hashes here.

File details

Details for the file fortext-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: fortext-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for fortext-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7e95a09fb55406ef53c113bb232915c37d6594f46e3ff269cad8626cf008022b
MD5 6e9d6b08f94b14a81b826ed788f0dc75
BLAKE2b-256 44f1b27850d0a4c4f43429c3ef0084e2c4b7fd9a112a27caa2833215688e0bb6

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