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

Getting Started

Prerequisites

  • Install or update the pip package manager.

    python3 -m pip install --upgrade pip
    
  • It's also recommended to use a virtual environment.

    • Linux / MacOS
      python3 -m venv <venv-name>
      source venv/bin/activate
      
    • Windows
      python3 -m venv <venv-name>
      <venv-name>/Scripts/activate
      

Installation

Use pip to install fortext.

python3 -m pip install --upgrade fortext

Install the required dependencies as listed on requirements.txt.

python3 -m pip install -r requirements.txt

Usage

Text styling

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]))

Syntax highlighting

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

Output:

syntax highlighting example output

Permutations

for perm in string_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.3.tar.gz (11.5 kB view hashes)

Uploaded Source

Built Distribution

fortext-0.0.3-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