Metadata-Version: 2.4
Name: printyful
Version: 1.1
Summary: A Python library for terminal customization.
Author: Jefferson
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Dynamic: author
Dynamic: description
Dynamic: description-content-type
Dynamic: requires-python
Dynamic: summary

# PRINTYFUL - You CLI application more beatiful!

Developed to improve the user experience in Python terminal applications, seeking simplicity of use and efficiency of applying beautiful decorations and loading screens to your application!

## How to use
Printyful is based on execution engines, where each engine has its own responsibility (inheriting executions from other engines) and is included in a final engine called FullMotor. Using this engine it will be possible to create decorated titles, panels, loading screens and other currently available decorations.

**Usage example:**
```
from printyful import FullMotor

motor = FullMotor()

title = motor.panel_title('Your life is great')
print(title)

motor.loading_bar(message='Downloading...', sleeptime=0.4 , final_text='100% (COMPLETE)')
```

## Available Motors

### 1. ColorMotor

Responsible for styling terminal text using ANSI color codes.

| Method | Description |
|---|---|
| `red_text(text)` | Displays text in red. |
| `blue_text(text)` | Displays text in blue. |
| `green_text(text)` | Displays text in green. |
| `yellow_text(text)` | Displays text in yellow. |

**Example:**

```python
from printyful import ColorMotor

color = ColorMotor()

print(color.red_text("Error!"))
print(color.green_text("Operation successful!"))
print(color.blue_text("Information"))
print(color.yellow_text("Warning!"))
```

### 2. BackgroudColorMotor

Inherits all features from `ColorMotor` and adds methods for applying background colors to terminal text.

| Method | Description |
|---|---|
| `red_background(text)` | Applies a red background. |
| `blue_background(text)` | Applies a blue background. |
| `green_background(text)` | Applies a green background. |
| `yellow_text(text)` | Applies a yellow background. |

**Example:**

```python
from printyful import BackgroudColorMotor

background = BackgroudColorMotor()

print(background.red_background(" ERROR "))
print(background.green_background(" SUCCESS "))
print(background.blue_background(" INFO "))
```

### 3. StylesMotor

Inherits the previous motors and introduces additional text formatting options.

| Method | Description |
|---|---|
| `bold_text(text)` | Makes text bold. |
| `sublime_text(text)` | Underlines text. |
| `invert_text(text)` | Inverts text and background colors. |

**Example:**

```python
from printyful import StylesMotor

styles = StylesMotor()

print(styles.bold_text("Important message"))
print(styles.sublime_text("Underlined text"))
print(styles.invert_text("Inverted text"))
```

### 4. PanelMotor

Responsible for creating visual panels and option lists directly in the terminal.

**Initialization parameter:**

| Parameter | Type | Default | Description |
|---|---|---|---|
| `title_color` | `str` | `'0'` | ANSI color code used for panel titles. |

**Methods:**

| Method | Description |
|---|---|
| `panel_title(title)` | Creates a visual panel containing a title. Requires at least 8 characters. |
| `panel_list_options_enumerated(options)` | Generates an automatically numbered option list. |
| `panel_list_options(options)` | Generates an option list with custom identifiers. |

**Example:**

```python
from printyful import PanelMotor

panel = PanelMotor(title_color='34')

print(panel.panel_title("PRINTYFUL"))

options = ["Start", "Settings", "Exit"]
print(panel.panel_list_options_enumerated(options))

custom_options = [
    ("A", "Start"),
    ("B", "Settings"),
    ("C", "Exit")
]

print(panel.panel_list_options(custom_options))
```

### 5. LoadingMotor

Inherits all previous functionalities and introduces loading animations for terminal applications.

**Method: `loading_text()`**

Displays a text-based loading animation using progressively increasing dots.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `text` | `str` | `'Loading'` | Text displayed during the animation. |
| `multiplier` | `int` | `3` | Maximum number of dots. |
| `sleeptime` | `float` | `0.8` | Time interval between updates, in seconds. |
| `await_confirm` | `bool` | `False` | Waits for user confirmation after completion. |

**Example:**

```python
from printyful import LoadingMotor

loading = LoadingMotor()

loading.loading_text(
    text="Initializing",
    multiplier=5,
    sleeptime=0.5,
    await_confirm=True
)
```

**Method: `loading_bar()`**

Creates a percentage-based loading bar with dynamically changing colors.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `multiplier` | `int` | `100` | Maximum progress value. |
| `sleeptime` | `float` | `0.8` | Time interval between updates. |
| `colors` | `List[str]` | `['31', '33', '32']` | ANSI color codes used by the progress bar. |
| `await_confirm` | `bool` | `False` | Waits for user confirmation after completion. |
| `final_text` | `str` | `''` | Additional text displayed beside the progress bar. |
| `message` | `str` | `''` | Message displayed during the loading process. |

Color transitions are determined by the current progress:

- 0%–49%: First color.
- 50%–79%: Second color.
- 80%–100%: Third color.

**Example:**

```python
from printyful import LoadingMotor

loading = LoadingMotor()

loading.loading_bar(
    multiplier=100,
    sleeptime=0.05,
    colors=['31', '33', '32'],
    message="Installing dependencies...",
    final_text="Installation",
    await_confirm=True
)
```

### 6. FullMotor

`FullMotor` combines all previously introduced motors into a single class.

It is the most complete option in the library, providing access to text colors, background colors, formatting, panels, and loading animations through a single instance.

**Initialization parameter:**

| Parameter | Type | Default | Description |
|---|---|---|---|
| `title_color` | `str` | `'0'` | ANSI color code used for panel titles. |

**Example:**

```python
from printyful import FullMotor

motor = FullMotor(title_color='34')

# Text colors
print(motor.red_text("Error"))
print(motor.green_text("Success"))

# Background colors
print(motor.blue_background("Information"))

# Text styles
print(motor.bold_text("Important"))

# Panels
print(motor.panel_title("MY APPLICATION"))

# Loading animations
motor.loading_text("Starting", sleeptime=0.3)
```

## Motor Inheritance Structure

Printyful uses an inheritance-based architecture, allowing each motor to reuse and extend the functionalities of its predecessor.

```text
ColorMotor
    |
    v
BackgroudColorMotor
    |
    v
StylesMotor
    |
    v
PanelMotor
    |
    v
LoadingMotor
    |
    v
FullMotor
```

## Installation

```bash
pip install printyful
```

## Additional Notes

- Colors and text formatting are implemented using ANSI escape sequences.
- Loading animations use `time.sleep()` to control animation speed.
- Terminal clearing uses the `clear` command, primarily targeting Linux and Unix environments.
- Each motor can be imported and instantiated independently. Using `FullMotor` is optional.

---

**Printyful** — Make your terminal more expressive.
