Skip to main content

Text stylizer for Python. Mainly useful 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]))

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-1.0.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

fortext-1.0.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fortext-1.0.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for fortext-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d229dc5f1595ef1475b1e99bd9854b18f25af7fdc045124dc341ed966adc8e5f
MD5 47f0f968fc2aa1def9fc71cf7d855da8
BLAKE2b-256 45053affd915c66977bb82db335d58f464da6944a24fcccaa440542160b4949f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fortext-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for fortext-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 63f78abbf37cd927e943a9e79c2a3da5ff7cec51cc7cd1cb762dcac75ef93aad
MD5 31637a012d24a97fb41ae09aee552075
BLAKE2b-256 c0b904018211c9b941f3f45c4072f83b4958a10dabe81ad92a744b38237858a9

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