PHPackages                             nikkanetiya/laravel-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. nikkanetiya/laravel-color-palette

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

nikkanetiya/laravel-color-palette
=================================

Laravel Wrapper for `ksubileau/color-thief-php`. Grabs the dominant color or a representative color palette from an image. Uses PHP and GD or Imagick.

1.3.0(7y ago)3312.6k23[2 issues](https://github.com/nikkanetiya/laravel-color-palette/issues)[1 PRs](https://github.com/nikkanetiya/laravel-color-palette/pulls)PHPPHP &gt;=5.6.4

Since Jul 7Pushed 6y ago2 watchersCompare

[ Source](https://github.com/nikkanetiya/laravel-color-palette)[ Packagist](https://packagist.org/packages/nikkanetiya/laravel-color-palette)[ Docs](https://github.com/nikkanetiya/laravel-color-palette)[ RSS](/packages/nikkanetiya-laravel-color-palette/feed)WikiDiscussions master Synced yesterday

READMEChangelog (5)Dependencies (2)Versions (6)Used By (0)

Laravel Color Palette
=====================

[](#laravel-color-palette)

Laravel Wrapper for [Color-Thief-PHP](https://github.com/ksubileau/color-thief-php) with additional changes. Grabs the **dominant color** or a **representative color palette** from an image. Uses PHP and GD or Imagick.

This Laravel package is extremely useful to grab **dominant color** or a **representative color palette** from images. See this image for the example.

[![example image](https://camo.githubusercontent.com/e3905250c0d3bdd8b1481069458f470e76bb6e6979d79027716fb129f651b6c2/68747470733a2f2f72617763646e2e6769746861636b2e636f6d2f6e696b6b616e65746979612f6c61726176656c2d636f6c6f722d70616c657474652f6d61737465722f74657374732f696d616765732f6578616d706c652e706e67)](https://camo.githubusercontent.com/e3905250c0d3bdd8b1481069458f470e76bb6e6979d79027716fb129f651b6c2/68747470733a2f2f72617763646e2e6769746861636b2e636f6d2f6e696b6b616e65746979612f6c61726176656c2d636f6c6f722d70616c657474652f6d61737465722f74657374732f696d616765732f6578616d706c652e706e67)

Contents
--------

[](#contents)

- [Installation](#installation)
- [Available Methods](#available-methods)

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

[](#installation)

You can install the package via [Composer](http://getcomposer.org):

```
composer require nikkanetiya/laravel-color-palette
```

You must install the service provider (For Laravel &lt; 5.5):

```
// config/app.php
'providers' => [
    ...
    NikKanetiya\LaravelColorPalette\ColorPaletteServiceProvider::class,
],
```

Register facade:

```
// config/app.php
'aliases' => [
    ...
    'ColorPalette' => NikKanetiya\LaravelColorPalette\ColorPaletteFacade::class,
],
```

Available Methods
-----------------

[](#available-methods)

1. **getColor()** - Use this method to get **most dominant single color** form image

    Example:

    ```
    // get most dominant color from image

    $color = ColorPalette::getColor( 'https://rawcdn.githack.com/nikkanetiya/laravel-color-palette/master/tests/images/strawberry.jpeg' );

    // Color provides several getters/properties
    echo $color;             // '#dc5550'
    echo $color->rgbString;  // 'rgb(220,85,80)'
    echo $color->rgbaString; // 'rgba(220,85,80,1)'
    echo $color->int;        // 14439760
    print_r($color->rgb);        // array(220, 85, 80)
    print_r($color->rgba);       // array(220, 85, 80, 1)
    ```

    #### Options

    [](#options)

    ```
    $color = ColorPalette::getColor($sourceImage, $quality = 10, $area = null );
    ```

    By default, `getColor` will have quality -&gt; 10 and specific area -&gt; null.

    - `Quality` can be int. 1 is the highest quality. There is a trade-off between quality and speed. The bigger the number, the faster the palette generation but the greater the likelihood that colors will be missed.
    - `Area` can be array|null $area\[x,y,w,h\]. It allows you to specify a rectangular area in the image in order to get colors only for this area. It needs to be an associative array with the following keys:
        - $area\['x'\]: The x-coordinate of the top left corner of the area. Default to 0.
        - $area\['y'\]: The y-coordinate of the top left corner of the area. Default to 0.
        - $area\['w'\]: The width of the area. Default to image width minus x-coordinate.
        - $area\['h'\]: The height of the area. Default to image height minus y-coordinate.
2. **getPalette()** - Use this method to find **representative color palette** form image.

    Example:

    ```
    // get colors from image

    $colors = ColorPalette::getPalette( 'https://github.com/nikkanetiya/laravel-color-palette/blob/master/tests/images/strawberry.jpeg' );

    foreach($colors as $color) {
        //
    }
    // Colors will be array of Color Objects
    ```

    #### Options

    [](#options-1)

    ```
    $color = ColorPalette::getPalette($sourceImage, $colorCount = 10, $quality = 10, $area = null)
    ```

    - `colorCount` can be 2 to 256. It is the number of colors you want to retrieve for the image.
    - `Quality` &amp; `Area` is same as above.

Image Source: `https://www.pexels.com`, `google image`

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 89.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 ~164 days

Total

5

Last Release

2576d ago

Major Versions

v0.1-alpha → 1.0.02017-07-09

### Community

Maintainers

![](https://www.gravatar.com/avatar/40cac397a4509e6207ca169028e142a4ce9a7da8a2c75bf19f056285b78db4f3?d=identicon)[kanetiya](/maintainers/kanetiya)

---

Top Contributors

[![nikkanetiya](https://avatars.githubusercontent.com/u/6582898?v=4)](https://github.com/nikkanetiya "nikkanetiya (26 commits)")[![AhmedFawzy](https://avatars.githubusercontent.com/u/171846?v=4)](https://github.com/AhmedFawzy "AhmedFawzy (1 commits)")[![luisdalmolin](https://avatars.githubusercontent.com/u/403446?v=4)](https://github.com/luisdalmolin "luisdalmolin (1 commits)")[![wouldhide](https://avatars.githubusercontent.com/u/5332996?v=4)](https://github.com/wouldhide "wouldhide (1 commits)")

---

Tags

color-palettecolor-thiefgdimage-colorsimage-processinglaravelphpphplaravelgdimage-colorscolor-palettecolor-thief

### Embed Badge

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

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

###  Alternatives

[intervention/image-laravel

Laravel Integration of Intervention Image

1496.5M102](/packages/intervention-image-laravel)[folklore/image

Image manipulation library for Laravel 5 based on Imagine and inspired by Croppa for easy url based manipulation

270248.2k5](/packages/folklore-image)[thapp/jitimage

Just in time image manipulation.

997.5k1](/packages/thapp-jitimage)[bjthecod3r/laravel-cloudflare-stream

A Laravel package for Cloudflare Stream.

203.4k](/packages/bjthecod3r-laravel-cloudflare-stream)

PHPackages © 2026

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