Download the PHP package aryehraber/statamic-color-extractor without Composer
On this page you can find all versions of the php package aryehraber/statamic-color-extractor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aryehraber/statamic-color-extractor
More information about aryehraber/statamic-color-extractor
Files in aryehraber/statamic-color-extractor
Package statamic-color-extractor
Short Description Extract colors from images.
License MIT
Homepage https://github.com/aryehraber/statamic-color-extractor
Informations about the package statamic-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.
Installation
Install the addon via composer:
Publish the config file:
Usage
Simply add the color
modifier to an image asset to output the HEX color value:
Example
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:
The default type can be changed to average
instead via the config file, which opens up a dominant
param:
The contrast
parameter will try to find a color from the image palette with the most contrast to the dominant color:
Dominant vs. Average vs. Contrast
Example screenshot to demonstrate the difference between the color extraction strategies:
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:
Credits
Inspiration: https://github.com/sylvainjule/kirby-colorextractor
Color Extractor: https://github.com/thephpleague/color-extractor
All versions of statamic-color-extractor with dependencies
davidgorges/color-contrast Version ^1.0
statamic/cms Version ^4.0 || ^5.0