NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist · #2365 most downloaded on Packagist
Grabs the dominant color or a representative color palette from an image.
Last release 3 months ago
26 Jun 2026
Release timing varies
gaps range from 2 months to 3.4 years
Nearly every release is documented
notes for 11 of 11 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
11 releases · first in 2014
URL fetching was removed because it can introduce Server-Side Request Forgery (SSRF) vulnerabilities if the URL is not validated before being passed t…
New features
readonly classes, enums, named arguments, ... (see #62, thank @joeworkman).getSwatches() method that classifies a palette into semantic swatch roles: vibrant, muted, darkVibrant, darkMuted, lightVibrant, lightMuted.whiteThreshold, alphaThreshold, and minSaturation options.colorSpace option. OKLCH produces more perceptually uniform palettes and is now the default.ImageRegion class to restrict color extraction to a rectangular region of the image, replacing the previous $area array parameter.toRgb(), toHsl(), toHsv(), toOklch(), toCmyk().toCss()), hex string (toHex()), packed integer (toInt()), component array (toArray()).luminance(), isDark(), isLight(), textColor().Bug fixes
getimagesize return value in GdAdapter::loadFromPath (see #62, thank @joeworkman).array_shift in GmagickAdapter::getPixelColor (see #62, thank @joeworkman).Breaking changes
ColorThief is now an instantiable readonly class. Static method calls (ColorThief::getColor(), ColorThief::getPalette()) are no longer supported; create an instance instead.quality and preferredAdapter are now constructor parameters. The $quality and $adapter positional arguments previously accepted by getColor() and getPalette() have been removed.$outputFormat parameter has been removed. getColor() now always returns an RgbColor object (or null) and getPalette() always returns a ColorPalette<RgbColor>. Use the conversion methods on the returned objects to get the format you need.$area array parameter has been replaced by a typed ImageRegion object passed as the $region named argument.getRed(), getGreen(), and getBlue() on the color object have been replaced by red(), green(), and blue() methods.getColor() or getPalette() now throws a NotReadableException.// Before
$color = ColorThief::getColor('https://example.com/image.jpg');
// After
use ColorThief\ColorThief;
$thief = new ColorThief();
$data = file_get_contents('https://example.com/image.jpg'); // Ensure you implement appropriate security controls when fetching the image
$color = $thief->getColor($data);colorSpace: ColorSpace::Rgb to restore the previous behavior.One column per quarter.
Support for PHP 8.4 (see #60 , thank @Redominus ).
New features
Fixes a regression in 2.0.0 that could cause an infinite loop under specific circumstances (see #52 ).
Bug fix
PHP 8 compatibility (see #48 and #50 , thank @Agapanthus ).
New features
ColorThief\Color class).Bug fix
getPalette() does not always return the requested amount of colors (see #5).Breaking changes
ColorThief\Exception\Exception. Migrating from 1.x may require tweaking exception handling in calling code to avoid unhandled exceptions or preserve error handling logic. See 1bf90f4 for details.Noticeable changes
New features
ColorThief\Color class).Bug fix
getPalette() does not always return the requested number of colors (see #5).Breaking changes
ColorThief\Exception\Exception.
Migrating from 1.x may require tweaking exception handling in calling code to avoid unhandled exceptions or preserve error handling logic. See 1bf90f40 for details.Noticeable changes
Significant performance improvement. Around 30% faster and between 20 to 50% less memory usage (see #44 , thank @mreiden ).
Drop support for PHP 5.3, now require 5.4+.
Improve handling of corrupted images: throw a RuntimeException if GD fails to load image. (see #30 , thank @othmar52 ).
Color Thief PHP now officially supports PHP 7 ! (see #19 ).
Add support of area targeting (see #12 ).
Add support for Imagick and GD resources. In addition to the path or URL of the image, now you can also directly pass the GD resource or Imagick insta
* Initial release
Your coding agent can read these notes before it upgrades. Set up the MCP server →