Metadata-Version: 2.1
Name: fortext
Version: 0.0.3
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: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.11
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)
* [Getting Started](#getting-started)
  * [Prerequisites](#prerequisites)
  * [Installation](#installation)
* [Usage](#usage)
  * [Text styling](#text-styling)
  * [Syntax highlighting](#syntax-highlighting)
  * [Permutations](#permutations)



## Getting Started

### Prerequisites
* Install or update the [pip](https://pip.pypa.io/en/stable/) package manager.
  ```sh
  python3 -m pip install --upgrade pip
  ```

* It's also recommended to use a [virtual environment](https://docs.python.org/3/library/venv.html).
  * Linux / MacOS
    ```bash
    python3 -m venv <venv-name>
    source venv/bin/activate
    ```
  * Windows
    ```bash
    python3 -m venv <venv-name>
    <venv-name>/Scripts/activate
    ```

### Installation

Use pip to install `fortext`.

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

Install the required dependencies as listed on [requirements.txt](./requirements.txt).
```shell
python3 -m pip install -r requirements.txt
```

## Usage

### Text styling

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

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

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

### Permutations
```python
for perm in string_permutations('abc'):
    print(perm)
```
Output:
```
a
b
c
ab
ac
ba
bc
ca
cb
abc
acb
bac
bca
cab
cba
```
