Metadata-Version: 2.4
Name: tinting
Version: 0.1.0
Summary: Markup-based terminal coloring engine
Author-email: Italo Almeida <italoalmeida@hezz.it>
License: MIT
Project-URL: Homepage, https://github.com/italoalmeida0/tinting
Project-URL: Repository, https://github.com/italoalmeida0/tinting
Project-URL: Issues, https://github.com/italoalmeida0/tinting/issues
Keywords: ansi,terminal,color,colour,markup,tui,cli,256-color
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
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: Topic :: Terminals
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# tinting

Markup-based terminal coloring engine.

`tinting` converts `@COLOR[ ... ]@` markup tokens into ANSI 256-color escape
sequences, so you can style terminal output without scattering raw escape
codes through your strings. It supports nested foreground/background colors,
bold/italic/underline modifiers, escaping, visible-length measurement, and
grid-oriented style helpers for terminal UIs.

## Installation

```bash
pip install tinting
```

## Quick start

```python
from tinting import tprint

tprint("@GRN[success]@ @YEL#[ warning ]@ @*RED[bold red]@")
```

## Markup syntax

| Token              | Meaning                                  |
| ------------------ | ---------------------------------------- |
| `@COLOR[text]@`    | Foreground color `COLOR`                 |
| `@BG#FG[text]@`    | Background `BG`, foreground `FG`         |
| `@*COLOR[text]@`   | Bold foreground                          |
| `@/COLOR[text]@`   | Italic foreground                        |
| `@_COLOR[text]@`   | Underlined foreground                    |
| `@|COLOR[ ... ]|@` | Escaped (rendered literally)             |

Modifiers `*`, `/`, `_` can be combined, e.g. `@*/BLU[text]@`.

## Colors

`tinting` ships a 256-color palette referenced by short codes:

```
SLV silver    GRY gray    LGR lightgray   BLK black    BGE beige
PNK pink      CRL coral   RED red         CRM crimson  MRN maroon
DRD darkred   YEL yellow  ORG orange      BRN brown    WHT white
GLD gold      LME lime    OLV olive       GRN green    FGN forestgreen
TRQ turquoise CYN cyan    TEA teal        BLU blue     NVY navy
IND indigo    VIO violet  LAV lavender    PRP purple   PLM plum
MAG magenta   RNB rainbow
```

## API

- `ttext(text, colors=True)` - convert markup to ANSI escape sequences.
- `tprint(*args, **kwargs)` - print styled text to stdout.
- `tprint_e(*args, **kwargs)` - print styled text to stderr.
- `tlen(text)` - visible length of a styled string (ignores markup).
- `tesc(text, clean=False)` - escape markup tokens so they render literally.
- `tslice(text, end, start=0)` - slice a styled string by visible count.
- `Tinting` - the engine class holding the palette and compiled pattern.
- `Tinting.by_name` - mapping of human-readable names to color codes.
- `TA` - grid-oriented style encoding helpers for terminal UIs.

## Environment

Color output auto-detection honors the `NO_COLOR`, `FORCE_COLOR`, and `CI`
environment variables, falling back to `stdout.isatty()`.

## License

MIT
