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-0.0.12.tar.gz (11.9 kB view hashes)

Uploaded Source

Built Distribution

fortext-0.0.12-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

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