Name: python-colorthief Version: 0.2.1 Release: 1%{?dist} Summary: Grab the dominant color or a color palette from an image License: BSD-3-Clause URL: https://github.com/fengsp/color-thief-py Source0: %{pypi_source colorthief} BuildArch: noarch BuildRequires: python3-devel %global _description %{expand: Color Thief finds the dominant color of an image, or a palette of its main colors, using the modified median cut quantization algorithm. It is a Python port of the Color Thief JavaScript library.} %description %{_description} %package -n python3-colorthief Summary: %{summary} %description -n python3-colorthief %{_description} %prep %autosetup -n colorthief-%{version} %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l colorthief %check %pyproject_check_import # No tests upstream: a two-color image must yield those two colors. %{py3_test_envvars} %{python3} - <<'PYEOF' import io from PIL import Image from colorthief import ColorThief img = Image.new("RGB", (100, 100), (200, 30, 30)) img.paste((20, 20, 220), (0, 0, 100, 30)) buf = io.BytesIO() img.save(buf, "PNG") buf.seek(0) ct = ColorThief(buf) dom = ct.get_color(quality=1) assert all(abs(a - b) < 12 for a, b in zip(dom, (200, 30, 30))), dom pal = ct.get_palette(color_count=2, quality=1) assert any(all(abs(a - b) < 12 for a, b in zip(c, (20, 20, 220))) for c in pal), pal PYEOF %files -n python3-colorthief -f %{pyproject_files} %doc README.rst %changelog * Sun Nov 01 2026 Morgan Hough - 0.2.1-1 - Initial package