Kirby panel hook plugin to extract the dominant color out of an image
Switch branches/tags
Nothing to show
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial Commit Aug 24, 2016 Add credits Aug 24, 2016
composer.json Remove trailing comma in composer.json Nov 25, 2016
dominantcolor.php Related to #1: avoid costly optimization when using ImageKit Apr 6, 2017
preview.jpg Add preview and Readme Aug 24, 2016

Extract an Image's dominant color - Kirby CMS Panel


Simple kirby panel hook that will extract the most dominant color for a given image and store it in the file's metadata on the color field as an hex value eg: #fefefe.

This is useful for example when lazyloading images, Google uses the same technique in Google Images.

The hook will fire for any image you upload or replace in the panel.


git submodule add site/plugins/dominantcolor

then run composer in the resulting directory

cd site/plugins/dominantcolor/
composer install

Diplaying the value in the panel field

Combined with You can have the extracted color displayed in the panel when looking at the image your blueprint's file fields :

      label: Dominant Color
      type: color

Using the value

The value will be available on the image object like such :

<?php $page->image('myimage.jpg')->color() ?>




All credits goes to @thephpleague for the actual color extracting process in PHP