Metadata-Version: 2.4
Name: fortext
Version: 1.1.2
Summary: Text stylizer for Python. Mainly useful for CLI output.
Project-URL: Homepage, https://github.com/4mbl/fortext
Project-URL: Bug Tracker, https://github.com/4mbl/fortext/issues
Author: 4MBL
License: MIT License
        
        Copyright (c) 2023 4MBL
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# [fortext](https://4mbl.link/gh/fortext)

Text stylizer for Python. Mainly useful for CLI output.

## Table of Contents

* [Table of Contents](#table-of-contents)
  * [Installation](#installation)
* [Usage](#usage)
  * [Text styling](#text-styling)
  * [Print all styles](#print-all-styles)
  * [Syntax highlighting](#syntax-highlighting)
  * [String permutations](#string-permutations)

### Installation

Use pip to install `fortext`.

```bash
python3 -m pip install --upgrade fortext
```

## Usage

### Text styling

```python
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

```python
from fortext import print_styles_all
print_styles_all()
```

### Syntax highlighting

```python
from fortext import highlight
print(highlight({'somekey': 'somevalue', 'anotherkey': [12.4, True, 23]}))
```

Output:

![syntax highlighting output](./img/syntax_highlighting.png)

### String permutations

```python
from fortext import permutations
for perm in permutations('abc'):
    print(perm)
```

Output:

```text
a
b
c
ab
ac
ba
bc
ca
cb
abc
acb
bac
bca
cab
cba
```
