PHPackages                             aryehraber/statamic-color-extractor - 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. aryehraber/statamic-color-extractor

ActiveStatamic-addon[Image &amp; Media](/categories/media)

aryehraber/statamic-color-extractor
===================================

Extract colors from images.

v2.1.0(3mo ago)128.7k3MITPHPPHP ^8.3

Since Apr 20Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/aryehraber/statamic-color-extractor)[ Packagist](https://packagist.org/packages/aryehraber/statamic-color-extractor)[ Docs](https://github.com/aryehraber/statamic-color-extractor)[ GitHub Sponsors](https://github.com/aryehraber)[ RSS](/packages/aryehraber-statamic-color-extractor/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (10)Dependencies (3)Versions (13)Used By (0)

Color Extractor
===============

[](#color-extractor)

**Extract colors from images.**

This addon provides a new Modifier which takes an image asset and returns its dominant (or average) color as a HEX value.

[![Color Extractor](https://user-images.githubusercontent.com/5065331/79727966-7b8e3a00-82ed-11ea-870a-8a5f4e0d05e8.jpg)](https://user-images.githubusercontent.com/5065331/79727966-7b8e3a00-82ed-11ea-870a-8a5f4e0d05e8.jpg)

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

[](#installation)

Install the addon via composer:

```
composer require aryehraber/statamic-color-extractor

```

Publish the config file:

```
php artisan vendor:publish --tag=color_extractor-config

```

Usage
-----

[](#usage)

Simply add the `color` modifier to an image asset to output the HEX color value:

```
{{ image | color }}
```

**Example**

```
---
image: my-colorful-image.jpg
---

// OR

{{ image }}

{{ /image }}
```

By default, the underlying color extractor tries to find the most dominant color in the image, however, results can vary (see example screenshot below). Therefore, an `average` param can be passed in to instead find the average color found in the image:

```
{{ image | color:average }}
```

The default type can be changed to `average` instead via the config file, which opens up a `dominant` param:

```
{{ image | color:dominant }}
```

The `contrast` parameter will try to find a color from the image palette with the most contrast to the dominant color:

```
{{ image | color:contrast }}
```

### Dominant vs. Average vs. Contrast

[](#dominant-vs-average-vs-contrast)

Example screenshot to demonstrate the difference between the color extraction strategies:

[![Color Extractor Diff](https://user-images.githubusercontent.com/5065331/98469153-3c1e3100-21de-11eb-9b04-3a82baa19bd4.jpg)](https://user-images.githubusercontent.com/5065331/98469153-3c1e3100-21de-11eb-9b04-3a82baa19bd4.jpg)

### Manually Editing Colors

[](#manually-editing-colors)

Whenever a color is extracted from an image, it's added to the asset's meta data. This means you can manually override it by adding the following fields to your `assets.yaml` blueprint:

```
title: Asset
fields:
  # existing fields
  -
    handle: color_dominant
    field:
      display: Dominant Color
      type: color
  -
    handle: color_average
    field:
      display: Average Color
      type: color
  -
    handle: color_contrast
    field:
      display: Contrast Color
      type: color
```

Extract Command
---------------

[](#extract-command)

By default, colors are extracted on-demand when the modifier is first used on an image. This can slow down page loads with many images.

To improve performance, pre-generate color data using the commands below.

Note: The command will skip assets that already have color data unless `--force` is used.

```
# Extract default color type for all assets
php please color-extractor:extract

# Extract all color types (dominant, average, contrast)
php please color-extractor:extract --all

# Filter by container
php please color-extractor:extract --container=assets

# Filter by container and folder
php please color-extractor:extract --container=assets --folder=products

# Force re-extraction even if colors already exist
php please color-extractor:extract --force
```

Auto Extract on Asset Upload
----------------------------

[](#auto-extract-on-asset-upload)

When `auto_extract` is enabled in the config file (see [Installation](#installation)), colors will automatically be extracted when new images are uploaded. This extracts all 3 color types (dominant, average, contrast) and is useful to ensure there's no slow down on first page load.

Credits
-------

[](#credits)

Inspiration:

Color Extractor:

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance81

Actively maintained with recent releases

Popularity32

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 91.3% 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 ~239 days

Recently: every ~351 days

Total

10

Last Release

103d ago

Major Versions

v1.5.0 → v2.0.02026-03-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/feb8339874c0e210568e851c528efe8f1ed651750c707a9a6a52a7919e6d54af?d=identicon)[aryehraber](/maintainers/aryehraber)

---

Top Contributors

[![aryehraber](https://avatars.githubusercontent.com/u/5065331?v=4)](https://github.com/aryehraber "aryehraber (42 commits)")[![dsturm](https://avatars.githubusercontent.com/u/384815?v=4)](https://github.com/dsturm "dsturm (2 commits)")[![helloDanuk](https://avatars.githubusercontent.com/u/8265902?v=4)](https://github.com/helloDanuk "helloDanuk (2 commits)")

---

Tags

statamiccolor extractorimage color

### Embed Badge

![Health badge](/badges/aryehraber-statamic-color-extractor/health.svg)

```
[![Health](https://phpackages.com/badges/aryehraber-statamic-color-extractor/health.svg)](https://phpackages.com/packages/aryehraber-statamic-color-extractor)
```

###  Alternatives

[intervention/image-laravel

Laravel Integration of Intervention Image

1558.1M159](/packages/intervention-image-laravel)[statamic/statamic

Statamic

829176.7k](/packages/statamic-statamic)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135212.4k7](/packages/statamic-rad-pack-runway)[intervention/image-driver-vips

libvips driver for Intervention Image

47144.1k10](/packages/intervention-image-driver-vips)[justbetter/statamic-image-optimize

Image optimization after upload

1318.4k](/packages/justbetter-statamic-image-optimize)[visuellverstehen/statamic-picturesque

A Statamic tag for building HTML-only responsive images.

1117.7k](/packages/visuellverstehen-statamic-picturesque)

PHPackages © 2026

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