jacobbuck/silverstripe-dominantcolor

This package is abandoned and no longer maintained. No replacement package was suggested.

Enhance the Image class by providing the dominant color from an image.

1.0.0 2017-05-20 12:45 UTC

This package is not auto-updated.

Last update: 2022-08-06 16:13:11 UTC


README

Enhance the Image class by providing the dominant color from an image. Uses Color Thief PHP.

Usage

Adds the DominantColor() method to Image which the primary dominant color of this Image as hex (i.e. '#bada55'.)

<div style="background-color:$SomeImage.DominantColor">
$color = Image::get()->find(…)->DominantColor();
…

Requirements

  • Silverstripe 3+
  • GD, Imagick or Gmagick

Installation

The recommended way to install is through Composer:

composer require jacobbuck/silverstripe-dominantcolor