Metadata-Version: 2.4
Name: pintar
Version: 0.7.3
Summary: A Python library for flexible terminal text coloring using ANSI escape codes
Author: michiTrader
Author-email: michiTrader <iden.c63@gmail.com>
License-Expression: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing :: General
Requires-Dist: pytest>=9.0.2 ; extra == 'dev'
Requires-Python: >=3.12
Provides-Extra: dev
Description-Content-Type: text/markdown

# pintar

A Python library for flexible terminal text coloring using ANSI escape codes.

## Installation

```bash
pip install pintar
```

## Quick Start

### Color text with `dye`

```python
from pintar import dye, RGB

# Foreground color with hex
text = dye("Hello world", "#FF5733")
print(text)

# Foreground and background
text = dye("Warning", fore="#FFFFFF", bg="#FF0000")
print(text)

# With style
text = dye("Bold text", fore="cyan", style="bold")
print(text)
```

### Color text with `pstr` (tag syntax)

```python
from pintar import pstr

pstr("[red]Red text[/]")
pstr("[bold][#FF5733]Bold orange[/][/]")
pstr("[green]Green on [on blue]blue background[/][/green]")
```

### Reusable coloring with `Brush`

```python
from pintar import Brush

red_bold = Brush.load(fore="#FF0000", style="bold")
print(red_bold("This text is red and bold"))
```

### Color a substring with `Stencil`

```python
from pintar import Stencil

s = Stencil("Hello cruel world", start=6, end=11)
print(s.spray(fore="#00FF00"))
```

### Custom colors

```python
from pintar import RGB, HSL, HEX

c1 = RGB(255, 128, 0)
c2 = HSL(210, 1.0, 0.5)
c3 = HEX("#3498db")

text = dye("Custom color", c1)
print(text)
```

### 256-color palette

```python
from pintar import dye

dye.palette()
```

## Supported color formats

| Format | Example |
|--------|---------|
| Hex string | `"#FF5733"` |
| Short hex | `"#F00"` |
| RGB tuple | `(255, 0, 0)` |
| RGB object | `RGB(255, 0, 0)` |
| HSL object | `HSL(0, 1.0, 0.5)` |
| HEX object | `HEX("#FF0000")` |
| ANSI index | `196` |

## Available styles

`bold`, `italic`, `underline`, `strikethrough`. Combine with `+`: `"bold+italic"`.

## License

MIT
