Metadata-Version: 2.4
Name: PaintByChar
Version: 0.7.0
Summary: Convert grid strings to colored images with per-character coloring.
Home-page: https://github.com/jgd10/PaintByChar
Author: James Derrick
Author-email: James Derrick <jgd10.github@gmail.com>
License: MIT License
        
        Copyright (c) 2025 James Derrick
        
        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.
        
Project-URL: Homepage, https://github.com/jgd10/PaintByChar
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pillow
Requires-Dist: matplotlib
Dynamic: license-file

# PaintByChar

<img src="assets/logo.png" alt="PaintByChar logo" width="200" />

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![Python 3.12](https://img.shields.io/badge/python-3.12+-blue.svg)](https://python.org)
[![PyPI version](https://img.shields.io/pypi/v/PaintByChar.svg)](https://pypi.org/project/PaintByChar/)
[![Docs](https://readthedocs.org/projects/paintbychar/badge/?version=latest)](https://paintbychar.readthedocs.io/en/latest/)
[![Tests](https://github.com/jgd10/PaintByChar/actions/workflows/python-tests.yml/badge.svg)](https://github.com/jgd10/PaintByChar/actions/workflows/python-tests.yml)

A tiny Python library for turning ASCII grids into colorful images. It is designed for quick visualizations of mazes, maps, game boards, and Advent of Code-style 2D text puzzles.

## Why PaintByChar?

- Turn a rectangular text grid into a rendered image in a few lines
- Map each character to a color automatically or via your own palette
- Support multiple rendering styles for cells, text, and background-label combinations
- Works well for generative art, puzzle visualizations, and debugging text-based layouts

## Features

- `string_to_image()` for direct text-to-image conversion
- `file_to_image()` for processing a text file as a grid
- Preset colormaps such as `viridis`, `plasma`, and `terrain`
- Custom `value_colors` dictionaries for full control over mapping
- Render modes: filled cells, colored text, and colored cells with background text

## Install

```bash
pip install paintbychar
```

## Quick example

```python
import paintbychar as pbc

grid = """0123
4567
89AB
"""

img = pbc.string_to_image(
    grid,
    preset="viridis",
    cell_size=24,
    render_style=pbc.RenderStyle.COLORED_CELLS,
)

pbc.save_image(img, "output_basic.png")
```

## Example output

<div align="center">
  <img src="README_assets/output_basic.png" alt="Basic example output" width="640" />
</div>

### More example images

<div align="center">
  <img src="README_assets/style_colored_text.png" alt="Styled text output" width="320" />
  <img src="README_assets/output_preset_plasma.png" alt="Preset output" width="320" />
</div>

## More examples

The repository includes several runnable examples in the [`examples/`](examples/) folder, including:

- `basic_example.py`
- `file_example.py`
- `styles_example.py`
- `preset_example.py`
- `advent_of_code_example.py`

## API reference

See the [documentation](docs/api.md) for a quick overview of the public functions
and options, or browse the [live docs site](https://paintbychar.readthedocs.io/en/latest/).

There is also documentation on Read the Docs with installation instructions, 
usage examples, and API reference. [Read the Docs](https://paintbychar.readthedocs.io/en/latest/index.html)

## Contributing

Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for setup instructions, testing guidance, and the pull request process.

## Code of conduct

This project follows the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md).

## License

This project is licensed under the [MIT License](LICENSE).

## Project status

PaintByChar is currently a small, focused library aimed at grid-based text rendering and visualization. It is suitable for personal, educational, and open-source use, and is prepared for broader community contributions as it matures.

## Social preview

A repository preview image is included in [`assets/social-preview.png`](assets/social-preview.png) and can be used as a GitHub social preview or banner asset.
