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
- Linux / MacOS
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:
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)