PHPackages                             yarri/material-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. yarri/material-palette

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

yarri/material-palette
======================

Prominent image colour extraction for PHP

1.3.0(6y ago)01Apache-2.0PHPPHP &gt;=5.4

Since May 19Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/yarri/material-palette-php)[ Packagist](https://packagist.org/packages/yarri/material-palette)[ Docs](https://github.com/marijnvdwerf/material-palette-php)[ RSS](/packages/yarri-material-palette/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (5)Versions (10)Used By (0)

Palette for PHP
===============

[](#palette-for-php)

[![Logo](docs/artwork.png)](docs/artwork.png)

**Palette** is a port of the Android library of the same name, for extracting a colour palette from an image. The results can then be used for tinting the interface to match the image.

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

[](#installation)

```
$ composer require 'marijnvdwerf/material-palette:~1.0'
```

Usage
-----

[](#usage)

Palette makes use of the [Intervention image library](https://github.com/Intervention/image) to load images, and supports both the Imagick and GD drivers. The performance of the Imagick driver is slightly better, but the difference is fairly small.

```
$manager = new ImageManager(array('driver' => 'imagick'));
$image = $manager->make('path/to/image.png');

$palette = Palette::generate($image);
echo $palette->getVibrantSwatch()->getColor();
```

Contrast
--------

[](#contrast)

You can get the contrast of a colour on a non-translucent background by calling `AbstractColor::calculateContrast($background, $foreground)`. Information on the recommended contrast ratio can be found at [the W3C recommendation](http://www.w3.org/TR/WCAG/#visual-audio-contrast-contrast).

```
$white = new RGBColor(1, 1, 1);
$black = new RGBColor(0, 0, 0);
$background = $palette->getVibrantSwatch()->getColor();

echo '';
if(AbstractColor::calculateContrast($background, $white) >= 3) {
    echo 'Palette';
} else {
    echo 'Palette';
}
echo '';
```

###  Health Score

33

—

LowBetter than 74% of packages

Maintenance46

Moderate activity, may be stable

Popularity1

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~231 days

Recently: every ~401 days

Total

8

Last Release

2387d ago

Major Versions

0.1.0 → 1.0.02015-06-01

PHP version history (4 changes)0.1.0PHP &gt;=5.3.2

1.0.0PHP ~5.3

1.1.0PHP &gt;=5.3

1.3.0PHP &gt;=5.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/6304dffbd91d7a978f98632b0e4e30d662dcdb691daadb1388a58984e98faf5c?d=identicon)[yarri](/maintainers/yarri)

---

Top Contributors

[![marijnvdwerf](https://avatars.githubusercontent.com/u/737603?v=4)](https://github.com/marijnvdwerf "marijnvdwerf (20 commits)")[![on2](https://avatars.githubusercontent.com/u/7304119?v=4)](https://github.com/on2 "on2 (3 commits)")[![agallou](https://avatars.githubusercontent.com/u/320372?v=4)](https://github.com/agallou "agallou (1 commits)")[![yarri](https://avatars.githubusercontent.com/u/974278?v=4)](https://github.com/yarri "yarri (1 commits)")

---

Tags

imagecolormaterial-designcolourmaterialpalette

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yarri-material-palette/health.svg)

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

###  Alternatives

[marijnvdwerf/material-palette

Prominent image colour extraction for PHP

2952.9k](/packages/marijnvdwerf-material-palette)[league/color-extractor

Extract colors from an image as a human would do.

1.3k4.7M18](/packages/league-color-extractor)[ksubileau/color-thief-php

Grabs the dominant color or a representative color palette from an image.

6353.8M38](/packages/ksubileau-color-thief-php)[brianmcdo/image-palette

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

179209.0k2](/packages/brianmcdo-image-palette)[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M100](/packages/intervention-image-laravel)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k22](/packages/bkwld-croppa)

PHPackages © 2026

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