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

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fortext-1.1.0.tar.gz
Algorithm Hash digest
SHA256 84d5f56113d554928d5e0091579b592da3f17b3c94307f5c5360b2dbd170ef7f
MD5 5ddb605e9b91d340ff498969877801e4
BLAKE2b-256 c92df2672167bc2bbd90945b16c79ff1c7eaabdd9c0f9e66d4564f6cdb51db33

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fortext-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3eb79f3e01ba10205b05238c5c8740c8472b3b8f361edac27233a4bca0d2640b
MD5 886beecc6f4cd858db6d0282401593b1
BLAKE2b-256 b6087d62b62a65e627df7a41d8b743043e29ac468eb943a8f90b3cb9d5e3b74f

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