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

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

kiritokatklian/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.

4.0.2(1y ago)25.4k↓32%1MITPHPPHP ^8.2

Since Jul 7Pushed 1y agoCompare

[ Source](https://github.com/kiritokatklian/laravel-color-palette)[ Packagist](https://packagist.org/packages/kiritokatklian/laravel-color-palette)[ Docs](https://github.com/kiritokatklian/laravel-color-palette)[ Fund](https://www.paypal.com/paypalme/kiritokatklian)[ RSS](/packages/kiritokatklian-laravel-color-palette/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (6)Versions (14)Used By (0)

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

[](#laravel-color-palette)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b007890d9568e913ab6ab9541633b8df1442dbbad9221a54181148133a864d00/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b697269746f6b61746b6c69616e2f6c61726176656c2d636f6c6f722d70616c657474652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kiritokatklian/laravel-color-palette)[![Total Downloads](https://camo.githubusercontent.com/ac2c0bb82434f2633ede5341afe108d2542e1d4db0d8cda7f9db18b336df0396/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b697269746f6b61746b6c69616e2f6c61726176656c2d636f6c6f722d70616c657474652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kiritokatklian/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/ed20595bbbeaf2d1143dfbad03bb4157661f7b0c118f009517a0d3b652b63d7d/68747470733a2f2f72617763646e2e6769746861636b2e636f6d2f6b697269746f6b61746b6c69616e2f6c61726176656c2d636f6c6f722d70616c657474652f6d61737465722f74657374732f696d616765732f6578616d706c652e706e67)](https://camo.githubusercontent.com/ed20595bbbeaf2d1143dfbad03bb4157661f7b0c118f009517a0d3b652b63d7d/68747470733a2f2f72617763646e2e6769746861636b2e636f6d2f6b697269746f6b61746b6c69616e2f6c61726176656c2d636f6c6f722d70616c657474652f6d61737465722f74657374732f696d616765732f6578616d706c652e706e67)

Contents
--------

[](#contents)

- [Installation](#installation)
- [Available Methods](#available-methods)
- [Test](#test)
- [License](#license)

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

[](#installation)

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

```
$ composer require kiritokatklian/laravel-color-palette
```

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

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

Register facade:

```
// config/app.php
'aliases' => [
    ...
    'ColorPalette' => Kiritokatklian\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/kiritokatklian/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/kiritokatklian/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.

Test
----

[](#test)

You can run the tests with:

```
$ composer run test
```

Credits
-------

[](#credits)

- [All Contributors](../../contributors)

A big thank you to [Nikunj Kanetiya](https://github.com/nikkanetiya) for creating the first version of this package.

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

License
-------

[](#license)

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

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance45

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~234 days

Recently: every ~239 days

Total

13

Last Release

428d ago

Major Versions

v0.1-alpha → 1.0.02017-07-09

1.3.0 → 2.0.02022-07-27

2.1.1 → 3.0.02023-03-12

3.0.0 → 4.0.02024-05-19

PHP version history (4 changes)v0.1-alphaPHP &gt;=5.6.4

2.0.0PHP ^8.0.2

3.0.0PHP ^8.1.0

4.0.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b39f6e928a36e5e42a38ee97960f6b1d34b18b990d314d81b784d8276d81692?d=identicon)[kiritokatklian](/maintainers/kiritokatklian)

---

Top Contributors

[![nikkanetiya](https://avatars.githubusercontent.com/u/6582898?v=4)](https://github.com/nikkanetiya "nikkanetiya (26 commits)")[![kiritokatklian](https://avatars.githubusercontent.com/u/6556281?v=4)](https://github.com/kiritokatklian "kiritokatklian (24 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)")[![pmayet](https://avatars.githubusercontent.com/u/1593076?v=4)](https://github.com/pmayet "pmayet (1 commits)")[![wouldhide](https://avatars.githubusercontent.com/u/5332996?v=4)](https://github.com/wouldhide "wouldhide (1 commits)")

---

Tags

phplaravelimagegdimage-colorscolor-palettecolor-thiefkurozorakiritokatkliancolor-generator

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[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.

3312.6k](/packages/nikkanetiya-laravel-color-palette)[intervention/image-laravel

Laravel Integration of Intervention Image

1536.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)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[thapp/jitimage

Just in time image manipulation.

997.5k1](/packages/thapp-jitimage)

PHPackages © 2026

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