Metadata-Version: 2.4
Name: colorthief-v3
Version: 3.3.1
Summary: Python port of the npm colorthief package API for dominant color, palettes, and semantic swatches.
Author: Lokesh Dhakar
License: MIT
Project-URL: Homepage, https://lokeshdhakar.com/projects/color-thief/
Project-URL: Source, https://github.com/lokesh/color-thief
Project-URL: NPM, https://www.npmjs.com/package/colorthief
Keywords: color,palette,image,sampling,colorthief,oklch
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.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Multimedia :: Graphics
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: Pillow>=9.0

# colorthief-v3

Python 3 package based on the latest npm `colorthief` API (`colorthief@3.3.1`).

It extracts dominant colors, palettes, semantic swatches, and rich color objects from images. The Python package uses Pillow for image decoding and keeps the npm package's core option names: `color_count`, `quality`, `color_space`, `ignore_white`, `white_threshold`, `alpha_threshold`, and `min_saturation`.

## Install

```bash
pip install .
```

## Usage

```python
from colorthief_v3 import get_color, get_palette, get_swatches

color = get_color("photo.jpg")
print(color.hex())       # "#e84393"
print(color.css())       # "rgb(232, 67, 147)"
print(color.text_color)  # "#000000" or "#ffffff"

palette = get_palette("photo.jpg", color_count=6)
print([c.hex() for c in palette])

swatches = get_swatches("photo.jpg")
print(swatches["Vibrant"].color.hex() if swatches["Vibrant"] else None)
```

CamelCase aliases are also exported for easier migration from JavaScript:
`getColor`, `getPalette`, `getSwatches`, `getPaletteProgressive`, and `createColor`.

## CLI

```bash
colorthief-v3 color photo.jpg --json
colorthief-v3 palette photo.jpg --count 6 --color-space oklch
colorthief-v3 swatches photo.jpg --css
```

## Source

This package was generated from the npm package metadata for `colorthief@3.3.1`. See `vendor/colorthief-npm.json`.
