PHPackages                             farzai/color-palette - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. farzai/color-palette

ActiveLibrary[Image &amp; Media](/categories/media)

farzai/color-palette
====================

A robust PHP library for extracting, analyzing, and managing color palettes from images

1.2.1(5mo ago)590.5k↓31.4%1[2 PRs](https://github.com/parsilver/color-palette-php/pulls)MITPHPPHP ^8.1CI passing

Since Nov 9Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/parsilver/color-palette-php)[ Packagist](https://packagist.org/packages/farzai/color-palette)[ Docs](https://github.com/parsilver/color-palette-php)[ GitHub Sponsors](https://github.com/parsilver)[ RSS](/packages/farzai-color-palette/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (10)Versions (16)Used By (0)

Color Palette PHP
=================

[](#color-palette-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/524daef728d94072848cf0afe5773e734c1f16a0c74e8f2c105c991b5519ccbe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6661727a61692f636f6c6f722d70616c657474652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/farzai/color-palette)[![Tests](https://camo.githubusercontent.com/e2a9f27e334a48d039a2e9b3d877483c35f2631319ebd57838b4333366090a7b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70617273696c7665722f636f6c6f722d70616c657474652d7068702f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/parsilver/color-palette-php/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/b6b919d92c861783de5dfb1879c887ed058b467905fd29e3a5a27f949013de42/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6661727a61692f636f6c6f722d70616c657474652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/farzai/color-palette)

A powerful PHP library for extracting color palettes from images and generating color themes. This package supports multiple image processing backends (GD and Imagick) and provides a rich set of color manipulation features.

[![Color Palette Example](example/output.png)](example/output.png)

Table of Contents
-----------------

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Core Concepts](#core-concepts)
- [Common Use Cases](#common-use-cases)
    - [Generate Website Theme from Logo](#1-generate-website-theme-from-logo)
    - [Create Accessible Color Scheme](#2-create-accessible-color-scheme-wcag-compliant)
    - [Extract Colors to CSS Variables](#3-extract-colors-and-generate-css-variables)
    - [Find Complementary Colors](#4-find-complementary-colors-for-design)
- [API Reference](#api-reference)
    - [Working with Images](#working-with-images)
    - [Extracting Color Palettes](#extracting-color-palettes)
    - [Color Format Conversions](#color-format-conversions)
    - [Color Manipulation](#color-manipulation)
    - [Color Analysis](#color-analysis)
    - [Theme Generation](#theme-generation)
- [Troubleshooting &amp; FAQ](#troubleshooting--faq)
- [Testing](#testing)
- [Contributing](#contributing)
- [License](#license)

Features
--------

[](#features)

- Extract dominant colors from images using advanced color quantization
- Support for multiple image formats (JPEG, PNG, GIF, etc.)
- Multiple image processing backends (GD and Imagick)
- Generate color themes with surface, background, and accent colors
- Color manipulation with RGB, HSL, HSV, CMYK, and LAB support
- Color contrast ratio calculations (WCAG compliance)
- Automatic text color suggestions for optimal readability
- Smart surface color recommendations based on color brightness
- Deterministic color extraction - same image always produces same results
- Immutable color objects - safe and predictable
- Memory efficient with support for large images

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- GD extension **OR** ImageMagick extension (at least one is required)
- Composer

Installation
------------

[](#installation)

Install the package via composer:

```
composer require farzai/color-palette
```

Quick Start
-----------

[](#quick-start)

### Simple Approach (Recommended)

[](#simple-approach-recommended)

Extract colors in one line:

```
use Farzai\ColorPalette\ColorPalette;

$palette = ColorPalette::fromImage('path/to/image.jpg', 5);
$colors = $palette->toArray();
// Result: ['#ff5733', '#33ff57', '#5733ff', '#f4a460', '#8b4513']
```

---

### Builder Pattern (Flexible)

[](#builder-pattern-flexible)

Chain multiple operations with the builder:

```
use Farzai\ColorPalette\ColorPalette;
use Farzai\ColorPalette\Color;

// Extract from image
$palette = ColorPalette::builder()
    ->fromImage('path/to/image.jpg')
    ->withCount(8)
    ->build();

// Generate from a base color
$palette = ColorPalette::builder()
    ->withBaseColor(Color::fromHex('#3498db'))
    ->withScheme('monochromatic', ['count' => 7])
    ->build();
```

---

### Advanced (Full Control)

[](#advanced-full-control)

Use individual components for dependency injection and custom configuration:

```
use Farzai\ColorPalette\ImageFactory;
use Farzai\ColorPalette\ColorExtractorFactory;

// Static methods
$image = ImageFactory::fromPath('path/to/image.jpg');
$extractor = ColorExtractorFactory::gd();
$palette = $extractor->extract($image, 5);

// Instance methods with dependencies
$extractor = (new ColorExtractorFactory($logger))->make('gd');
$palette = $extractor->extract($image, 5);
```

Core Concepts
-------------

[](#core-concepts)

### ImageFactory

[](#imagefactory)

Load images from files for color extraction.

```
// Simple static method
$image = ImageFactory::fromPath('photo.jpg');

// Specify driver (gd or imagick)
$image = ImageFactory::fromPath('photo.jpg', 'imagick');
```

### ColorExtractor

[](#colorextractor)

Extract dominant colors using color quantization. Two drivers available:

- **GD** - Built into most PHP installations
- **Imagick** - More accurate, better for complex images

```
// Simple static methods
$extractor = ColorExtractorFactory::gd();
$extractor = ColorExtractorFactory::imagick();
```

### ColorPalette

[](#colorpalette)

A collection of extracted colors with array-like access.

```
$palette = ColorPalette::fromImage('photo.jpg', 5);

// Access colors
$colors = $palette->toArray();     // Returns ['#ff5733', ...]
$firstColor = $palette[0];         // Array access
$count = count($palette);          // Countable
```

### Color Objects

[](#color-objects)

Immutable objects supporting multiple color spaces.

```
$color = Color::fromHex('#ff5733');

// Manipulation returns NEW color objects
$lighter = $color->lighten(0.2);
$darker = $color->darken(0.3);
```

**Note:** Color objects are immutable - methods always return new instances.

Common Use Cases
----------------

[](#common-use-cases)

### 1. Generate Website Theme from Logo

[](#1-generate-website-theme-from-logo)

Extract colors from your logo and create a complete theme:

```
use Farzai\ColorPalette\ColorPalette;

// Extract colors from logo
$palette = ColorPalette::fromImage('assets/logo.png', 8);

// Get suggested theme colors
$theme = $palette->getSuggestedSurfaceColors();

echo "Primary: " . $theme['surface']->toHex();      // #f5f5f5
echo "Background: " . $theme['background']->toHex(); // #e8e8e8
echo "Accent: " . $theme['accent']->toHex();         // #ff5733

// Get appropriate text colors
$textOnPrimary = $palette->getSuggestedTextColor($theme['surface']);
$textOnAccent = $palette->getSuggestedTextColor($theme['accent']);
```

### 2. Create Accessible Color Scheme (WCAG Compliant)

[](#2-create-accessible-color-scheme-wcag-compliant)

Ensure your color combinations meet accessibility standards:

```
use Farzai\ColorPalette\Color;

$background = Color::fromHex('#ffffff');
$primary = Color::fromHex('#1976d2');

// Check contrast ratio
$ratio = $background->getContrastRatio($primary);
echo "Contrast Ratio: {$ratio}:1\n";

// Validate WCAG compliance
if ($ratio >= 7.0) {
    echo "PASS: WCAG AAA - Normal Text\n";
} elseif ($ratio >= 4.5) {
    echo "PASS: WCAG AA - Normal Text\n";
} elseif ($ratio >= 3.0) {
    echo "PASS: WCAG AA - Large Text\n";
} else {
    echo "FAIL: Does not meet WCAG standards\n";

    // Automatically adjust for compliance
    $adjustedPrimary = $primary->darken(0.2);
    $newRatio = $background->getContrastRatio($adjustedPrimary);
    echo "Adjusted Color: " . $adjustedPrimary->toHex() . "\n";
    echo "New Ratio: {$newRatio}:1\n";
}
```

### 3. Generate CSS Variables from Image

[](#3-generate-css-variables-from-image)

Create CSS custom properties from image colors:

```
use Farzai\ColorPalette\ColorPalette;

$palette = ColorPalette::fromImage('hero-image.jpg', 6);

echo ":root {\n";
foreach ($palette->getColors() as $index => $color) {
    $hex = $color->toHex();
    $rgb = $color->toRgb();

    echo "  --color-{$index}: {$hex};\n";
    echo "  --color-{$index}-rgb: {$rgb['r']}, {$rgb['g']}, {$rgb['b']};\n";
}
echo "}\n";

// Output:
// :root {
//   --color-0: #ff5733;
//   --color-0-rgb: 255, 87, 51;
//   --color-1: #33ff57;
//   --color-1-rgb: 51, 255, 87;
//   ...
// }
```

### 4. Generate Color Schemes

[](#4-generate-color-schemes)

Create color harmonies using built-in schemes:

```
use Farzai\ColorPalette\ColorPalette;
use Farzai\ColorPalette\Color;

$brandColor = Color::fromHex('#3498db');

// Automatic scheme generation
$complementary = ColorPalette::fromColor($brandColor, 'complementary');
$triadic = ColorPalette::fromColor($brandColor, 'triadic');
$monochromatic = ColorPalette::fromColor($brandColor, 'monochromatic', ['count' => 7]);

// Manual color manipulation
$lighter = $brandColor->lighten(0.2);
$darker = $brandColor->darken(0.2);
$rotated = $brandColor->rotate(180);  // Complementary
```

API Reference
-------------

[](#api-reference)

### Working with Images

[](#working-with-images)

#### Simple: ColorPalette::fromImage()

[](#simple-colorpalettefromimage)

```
$palette = ColorPalette::fromImage('photo.jpg', 5);
```

**Parameters:**

- `$path` (string) - Path to image file
- `$count` (int) - Number of colors to extract (default: 5)
- `$driver` (string) - 'gd' or 'imagick' (default: 'gd')

**Returns:** `ColorPalette`

#### Advanced: ImageFactory

[](#advanced-imagefactory)

```
// Static method
$image = ImageFactory::fromPath('photo.jpg', 'gd');

// Instance method (for dependency injection)
$factory = new ImageFactory($extensionChecker);
$image = $factory->createFromPath('photo.jpg');
```

### Extracting Color Palettes

[](#extracting-color-palettes)

#### Simple: ColorPalette::fromImage()

[](#simple-colorpalettefromimage-1)

```
$palette = ColorPalette::fromImage('photo.jpg', 5);
```

#### Advanced: Using ColorExtractor

[](#advanced-using-colorextractor)

```
// Static methods
$extractor = ColorExtractorFactory::gd();
$extractor = ColorExtractorFactory::imagick();

// Extract colors
$palette = $extractor->extract($image, 5);
```

### Color Format Conversions

[](#color-format-conversions)

The `Color` class supports multiple color space conversions:

#### Creating Colors

[](#creating-colors)

```
// From different formats
$color = Color::fromHex('#ff5733');                          // Hex string (with or without #)
$color = Color::fromRgb(['r' => 255, 'g' => 87, 'b' => 51]); // RGB array (or numeric: [255, 87, 51])
$color = Color::fromHsl(9, 100, 60);                         // HSL values (h: 0-360, s/l: 0-100)
$color = Color::fromHsv(9, 80, 100);                         // HSV values (h: 0-360, s/v: 0-100)
$color = Color::fromCmyk(0, 66, 80, 0);                      // CMYK values (0-100)
$color = Color::fromLab(62, 52, 51);                         // LAB values (l: 0-100, a/b: -128 to 127)
```

#### Converting Colors

[](#converting-colors)

```
$hex = $color->toHex();    // Returns: '#ff5733'
$rgb = $color->toRgb();    // Returns: ['r' => 255, 'g' => 87, 'b' => 51]
$hsl = $color->toHsl();    // Returns: ['h' => 9, 's' => 100, 'l' => 60]
$hsv = $color->toHsv();    // Returns: ['h' => 9, 's' => 80, 'v' => 100]
$cmyk = $color->toCmyk();  // Returns: ['c' => 0, 'm' => 66, 'y' => 80, 'k' => 0]
$lab = $color->toLab();    // Returns: ['l' => 62, 'a' => 52, 'b' => 51]
```

### Color Manipulation

[](#color-manipulation)

All manipulation methods return **new** Color instances (immutable):

```
$color = Color::fromHex('#3498db');

// Lighten and darken
$lighter = $color->lighten(0.2);      // Lighten by 20% (0.0 to 1.0)
$darker = $color->darken(0.2);        // Darken by 20% (0.0 to 1.0)

// Adjust saturation
$saturated = $color->saturate(0.3);   // Increase saturation by 30%
$desaturated = $color->desaturate(0.3); // Decrease saturation by 30%

// Rotate hue (color wheel)
$rotated = $color->rotate(180);       // Rotate hue by 180 degrees (0-360)

// Set specific lightness
$withLightness = $color->withLightness(0.5); // Set lightness to 50% (0.0 to 1.0)
```

### Color Analysis

[](#color-analysis)

```
$color = Color::fromHex('#3498db');

// Brightness (0-255)
$brightness = $color->getBrightness();  // Returns: float (0.0 to 255.0)
$isLight = $color->isLight();           // true if brightness > 128
$isDark = $color->isDark();             // true if brightness getLuminance();    // Returns: float (0.0 to 1.0)

// Contrast ratio (for accessibility)
$textColor = Color::fromHex('#ffffff');
$ratio = $color->getContrastRatio($textColor); // Returns: float (1.0 to 21.0)
```

**WCAG Contrast Requirements:**

- **AAA Normal Text:** 7:1 or higher
- **AA Normal Text:** 4.5:1 or higher
- **AA Large Text:** 3:1 or higher

### Theme Generation

[](#theme-generation)

#### ColorPalette::getSuggestedSurfaceColors()

[](#colorpalettegetsuggestedsurfacecolors)

Get a complete color theme from the palette:

```
$theme = $palette->getSuggestedSurfaceColors();
```

**Returns:** Array with keys:

- `'surface'` - Lightest color (main surface)
- `'background'` - Second lightest (secondary backgrounds)
- `'accent'` - Accent color with good contrast
- `'surface_variant'` - Variant of surface color

#### ColorPalette::getSuggestedTextColor()

[](#colorpalettegetsuggestedtextcolor)

Get optimal text color (black or white) for a background:

```
$textColor = $palette->getSuggestedTextColor($backgroundColor);
```

**Parameters:**

- `$backgroundColor` (ColorInterface) - Background color

**Returns:** `ColorInterface` - Either black (#000000) or white (#ffffff) based on contrast

Troubleshooting &amp; FAQ
-------------------------

[](#troubleshooting--faq)

### Which image processing extension should I use?

[](#which-image-processing-extension-should-i-use)

**GD (Recommended for most users):**

- Pre-installed in most PHP environments
- Good color extraction quality
- Lower memory usage
- Slightly less accurate than Imagick

**Imagick (For better accuracy):**

- More accurate color extraction
- Better handling of complex images
- Supports more image formats
- Requires additional installation
- Higher memory usage

### How do I check which extension is installed?

[](#how-do-i-check-which-extension-is-installed)

```
// Check for GD
if (extension_loaded('gd')) {
    echo "GD is installed\n";
}

// Check for Imagick
if (extension_loaded('imagick')) {
    echo "Imagick is installed\n";
}
```

Or use the built-in checker:

```
try {
    $extractor = ColorExtractorFactory::gd();
    echo "GD is available\n";
} catch (\RuntimeException $e) {
    echo "GD is not available\n";
}
```

### How do I install GD or Imagick?

[](#how-do-i-install-gd-or-imagick)

**Ubuntu/Debian:**

```
# Install GD
sudo apt-get install php-gd

# Install Imagick
sudo apt-get install php-imagick
```

**macOS (Homebrew):**

```
# Install GD (usually included with PHP)
brew install php

# Install Imagick
brew install imagemagick
pecl install imagick
```

**Restart your web server after installation!**

### The colors extracted don't look right

[](#the-colors-extracted-dont-look-right)

1. **Try the other driver** - Imagick often produces more accurate results:

    ```
    $palette = ColorPalette::fromImage('photo.jpg', 5, 'imagick');
    ```
2. **Extract more colors** - Increase the count for better variety:

    ```
    $palette = ColorPalette::fromImage('photo.jpg', 10);
    ```
3. **Check image quality** - Low quality or heavily compressed images may produce poor results
4. **Image has many similar colors** - This is expected behavior; the library finds dominant colors

### Memory issues with large images

[](#memory-issues-with-large-images)

For very large images (&gt; 5MB), consider:

1. **Resize before processing** (using GD or Imagick directly)
2. **Increase PHP memory limit** in php.ini: ```
    memory_limit = 256M
    ```
3. **Use GD instead of Imagick** (lower memory usage)

### Supported image formats

[](#supported-image-formats)

**GD Driver:**

- JPEG/JPG
- PNG
- GIF
- WebP (PHP 7.1+)

**Imagick Driver:**

- All of the above plus:
- TIFF
- BMP
- PSD
- And many more

### Why are my Color objects not changing?

[](#why-are-my-color-objects-not-changing)

Color objects are **immutable**. Methods return new instances:

```
$color = Color::fromHex('#3498db');

// WRONG - This doesn't work!
$color->lighten(0.2);
echo $color->toHex(); // Still #3498db

// CORRECT - Assign the result
$lighter = $color->lighten(0.2);
echo $lighter->toHex(); // Lighter color!
```

### How many colors should I extract?

[](#how-many-colors-should-i-extract)

- **5-8 colors** - Good for general use, themes
- **10-15 colors** - More variety, better for finding specific shades
- **3-5 colors** - Minimal, quick extraction

More colors = more processing time and memory usage.

Security
--------

[](#security)

### HTTP Client Security

[](#http-client-security)

The library implements comprehensive security measures when loading images from URLs to protect against SSRF (Server-Side Request Forgery) and other attacks.

#### SSRF Protection

[](#ssrf-protection)

All remote URLs are validated before making HTTP requests:

**Blocked Protocols:**

- Only `http://` and `https://` are allowed
- All other protocols (`file://`, `ftp://`, `gopher://`, etc.) are rejected

**Blocked IP Addresses:**

- Localhost: `127.0.0.1`, `::1`
- Private networks: `10.0.0.0/8`, `172.16.0.0/12`, `192.168.0.0/16`
- Link-local: `169.254.0.0/16`, `fe80::/10`
- Unique local (IPv6): `fc00::/7`, `fd00::/8`
- IPv4-mapped IPv6 addresses: `::ffff:0:0/96`

```
use Farzai\ColorPalette\ImageLoaderFactory;

$factory = new ImageLoaderFactory;
$loader = $factory->create();

// These will throw SsrfException:
$loader->load('http://localhost/internal-image.jpg');  // Blocked
$loader->load('http://192.168.1.1/image.jpg');         // Blocked
$loader->load('http://[::1]/image.jpg');               // Blocked
$loader->load('file:///etc/passwd');                    // Blocked

// Only public HTTP/HTTPS URLs are allowed:
$loader->load('https://example.com/public-image.jpg'); // OK
```

#### File Size Limits

[](#file-size-limits)

Downloaded files are limited to **10MB by default** to prevent denial-of-service attacks:

```
use Farzai\ColorPalette\Config\HttpClientConfig;
use Farzai\ColorPalette\ImageLoaderFactory;

// Custom file size limit (5MB)
$config = new HttpClientConfig(
    maxFileSizeBytes: 5 * 1024 * 1024
);

$factory = new ImageLoaderFactory(httpConfig: $config);
$loader = $factory->create();

// Will throw HttpException if file exceeds 5MB
$loader->load('https://example.com/huge-image.jpg');
```

Files are streamed in chunks (8KB at a time) and validated during download, not loaded entirely into memory.

#### MIME Type Validation

[](#mime-type-validation)

Remote files are validated to ensure they're actual images:

1. **Content-Type Header:** Checked if present in HTTP response
2. **File Detection:** Actual file content verified using `finfo` after download

Only these MIME types are accepted:

- `image/jpeg`, `image/jpg`
- `image/png`
- `image/gif`
- `image/webp`
- `image/bmp`
- `image/tiff`
- `image/svg+xml`

#### HTTP Client Configuration

[](#http-client-configuration)

Customize HTTP client behavior for security and performance:

```
use Farzai\ColorPalette\Config\HttpClientConfig;
use Farzai\ColorPalette\ImageLoaderFactory;

$config = new HttpClientConfig(
    timeoutSeconds: 30,           // Request timeout (default: 30)
    maxRedirects: 0,              // Follow redirects (default: 0 - disabled)
    maxFileSizeBytes: 10485760,   // Max file size in bytes (default: 10MB)
    userAgent: 'MyApp/1.0',       // Custom User-Agent header
    verifySsl: true               // SSL certificate verification (default: true)
);

$factory = new ImageLoaderFactory(httpConfig: $config);
$loader = $factory->create();
```

**Security Recommendations:**

1. **Keep `maxRedirects: 0`** - Redirects can bypass SSRF protection
2. **Keep `verifySsl: true`** - Prevents man-in-the-middle attacks
3. **Set appropriate timeout** - Prevents hanging on slow servers
4. **Limit file size** - Protects against DoS via large downloads

#### Exception Handling

[](#exception-handling)

Different exception types for different security scenarios:

```
use Farzai\ColorPalette\Exceptions\SsrfException;
use Farzai\ColorPalette\Exceptions\HttpException;
use Farzai\ColorPalette\Exceptions\InvalidImageException;

try {
    $loader->load($userProvidedUrl);
} catch (SsrfException $e) {
    // URL validation failed (private IP, invalid protocol, etc.)
    log_security_event('SSRF attempt blocked', $userProvidedUrl);
} catch (HttpException $e) {
    // HTTP error (status code, file size, MIME type, etc.)
    log_error('Failed to download image', $e->getMessage());
} catch (InvalidImageException $e) {
    // Image processing error
    log_error('Invalid image', $e->getMessage());
}
```

### Best Practices for User-Provided URLs

[](#best-practices-for-user-provided-urls)

When accepting URLs from users:

```
// ✓ GOOD: Validate and handle errors
try {
    $palette = ColorPalette::fromImage($userUrl, count: 5);
} catch (SsrfException $e) {
    // Don't expose internal network structure in error messages
    throw new UserFacingException('Invalid URL provided');
}

// ✗ BAD: Don't blindly trust user input
$palette = ColorPalette::fromImage($_GET['url']); // Dangerous!

// ✓ GOOD: Add URL whitelist for extra security
$allowedDomains = ['cdn.example.com', 'images.example.com'];
$host = parse_url($userUrl, PHP_URL_HOST);

if (!in_array($host, $allowedDomains)) {
    throw new Exception('URL not from allowed domain');
}
```

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

Run tests with coverage:

```
composer test:coverage
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](https://github.com/parsilver/color-palette-php/security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [All Contributors](https://github.com/parsilver/color-palette-php/contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance75

Regular maintenance activity

Popularity38

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~76 days

Recently: every ~91 days

Total

6

Last Release

172d ago

Major Versions

0.1.0 → 1.0.02024-11-28

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4928451?v=4)[parsilver](/maintainers/parsilver)[@parsilver](https://github.com/parsilver)

---

Top Contributors

[![parsilver](https://avatars.githubusercontent.com/u/4928451?v=4)](https://github.com/parsilver "parsilver (76 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (11 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")[![ImgBotApp](https://avatars.githubusercontent.com/u/31427850?v=4)](https://github.com/ImgBotApp "ImgBotApp (1 commits)")

---

Tags

gdimagickimage processingcolorrgbaccessibilitywcaghslpalettehsvcolor-extractioncolor-analysistheme-generationcontrast-ratio

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/farzai-color-palette/health.svg)

```
[![Health](https://phpackages.com/badges/farzai-color-palette/health.svg)](https://phpackages.com/packages/farzai-color-palette)
```

###  Alternatives

[league/glide

Wonderfully easy on-demand image manipulation library with an HTTP based API.

2.6k51.2M116](/packages/league-glide)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[talesoft/phim

An image and color manipulation and processing library for PHP

2958.2k](/packages/talesoft-phim)[brianmcdo/image-palette

Extracts colors from an image and generates a color palette against a whitelist of colors.

179209.0k2](/packages/brianmcdo-image-palette)[ozdemirburak/iris

PHP library for color manipulation and conversion.

1201.7M16](/packages/ozdemirburak-iris)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
