Skip to main content

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

pip install .

Usage

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

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.

Metadata

Release files for colorthief-v3 3.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for colorthief-v3 3.3.1
File Interpreter ABI Platform Actions
colorthief_v3-3.3.1-py3-none-any.whl Python 3 none any Details for colorthief_v3-3.3.1-py3-none-any.whl

Release files / colorthief_v3-3.3.1-py3-none-any.whl

Download URL colorthief_v3-3.3.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c2442ff9acca28fc499462bfc9ec9a9179f6589815d0a5359e87de85a38f266
BLAKE2b-256 checksum
How to use checksums
3339d2f0411a2414b42ac594f63478009fd6eef32608460d3a9d517ed1a9f514
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.11

Security for colorthief-v3 3.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.3.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page