Metadata-Version: 2.3
Name: painto
Version: 0.3.0
Summary: A flexible color library
License: MIT
Author: Michael Knowles
Requires-Python: >=3.12
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Project-URL: Documentation, https://mapledyne.github.io/painto/
Project-URL: Source, https://github.com/mapledyne/painto/
Description-Content-Type: text/markdown

# Painto

A flexible color library for Python with support for multiple color formats, arithmetic operations, and extensive color collections.

## Quick Start

```python
import painto

# Create colors from names, hex, or RGB values
red = painto.red
blue = painto.Color("#0000ff")
green = painto.Color(0, 255, 0)

# Basic color properties
print(red.hex)        # "#ff0000"
print(red.rgb)        # (255, 0, 0)
print(red.hsv)        # (0.0, 1.0, 1.0)

# Color arithmetic
purple = red + blue
darker_red = red / 2
lighter_blue = blue * 2

# Generate color ranges
gradient = list(panto.color_range(red, blue, 5))
```

## Key Features

- **Multiple Input Formats**: Names, hex strings, RGB/RGBA tuples
- **Color Collections**: W3C, XKCD
- **Color Spaces**: RGB, HSV, HSL, and grayscale conversion
- **Console Output**: ANSI color codes for terminal display

## Basic Usage

### Creating Colors

All color names from w3c/css, the XKCD color list, pride are available and
searched in that order, so red (in all three lists) will return the w3c red
unless another list is specifically requested.

```python
# From color names
red = painto.red
blue = painto.blue

# From specific color spaces:

red = painto.xkcd.red  # XKCD red is #e50000

# From hex strings
purple = painto.Color("#800080")
transparent_red = painto.Color("#ff000080")  # With alpha

# From RGB values
green = painto.Color(0, 255, 0)
yellow = painto.Color(255, 255, 0, 128)  # With alpha

# Random
new_color = painto.random_color()
new_w3c_color = painto.w3c.random()
new_colors = painto.xkcd.random(10)  # will return a list of colors from the list

# For contrasting text, this returns black or white, depending on which is
# more contrasting, for use as text on a <color> background, for instance.
foreground = yellow.foreground  # Will return black, for yellow

```

### Color Properties
```python
color = painto.orange

print(color.r, color.g, color.b, color.a)  # 255 165 0 255
print(color.hex)                            # "#ffa500"
print(color.name)                           # "orange"
print(color.luminosity)                     # 0.696
print(color.hsv)                            # (0.108, 1.0, 255)
```

### Color Operations
```python
red = painto.red
blue = painto.blue

# Blend colors
purple = red + blue

# Scale brightness
darker = red / 2
lighter = blue * 2

```

### Color Ranges
```python
# Generate gradient between colors
colors = painto.color_range(Color("red"), Color("blue"), 10)  # 10 steps

# Inclusive range (includes end color)
colors = painto.color_range(Color("red"), Color("blue"), 5, inclusive=True)
```

### Console Output
```python
color = painto.green
print(f"Here is some {color.console_string("Green text")}")
print(f"And some {color.console_string_bg("Green background with contrasting text")}")
```

## Installation

```bash
pip install painto
```

## Documentation

For more information, see the complete [documentation](https://mapledyne.github.io/painto/)

## License

MIT License - see LICENSE file for details.

