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

jacobbuck/silverstripe-dominantcolor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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