Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Latest commit

 

History

History
32 lines (22 loc) · 643 Bytes

readme.md

File metadata and controls

32 lines (22 loc) · 643 Bytes

silverstripe-dominantcolor

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