2017 © Pedro Peláez
 

library material-palette

Prominent image colour extraction for PHP

image

marijnvdwerf/material-palette

Prominent image colour extraction for PHP

  • Friday, April 14, 2017
  • by marijnvdwerf
  • Repository
  • 3 Watchers
  • 22 Stars
  • 19,429 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 6 Open issues
  • 9 Versions
  • 7 % Grown

The README.md

Palette for PHP

Logo, (*1)

Palette is a port of the Android library of the same name, for extracting a colour palette from an image. The results can then be used for tinting the interface to match the image., (*2)

Installation

$ composer require 'marijnvdwerf/material-palette:~1.0'

Usage

Palette makes use of the Intervention image library to load images, and supports both the Imagick and GD drivers. The performance of the Imagick driver is slightly better, but the difference is fairly small., (*3)

$manager = new ImageManager(array('driver' => 'imagick'));
$image = $manager->make('path/to/image.png');

$palette = Palette::generate($image);
echo $palette->getVibrantSwatch()->getColor();

Contrast

You can get the contrast of a colour on a non-translucent background by calling AbstractColor::calculateContrast($background, $foreground). Information on the recommended contrast ratio can be found at the W3C recommendation., (*4)

$white = new RGBColor(1, 1, 1);
$black = new RGBColor(0, 0, 0);
$background = $palette->getVibrantSwatch()->getColor();

echo '

'; if(AbstractColor::calculateContrast($background, $white) >= 3) { echo '

Palette

'; } else { echo '

Palette

'; } echo '
';

The Versions

14/04 2017

dev-master

9999999-dev https://github.com/marijnvdwerf/material-palette-php

Prominent image colour extraction for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

image palette material-design color material colour material design

14/04 2017

1.2.0

1.2.0.0 https://github.com/marijnvdwerf/material-palette-php

Prominent image colour extraction for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

image palette material-design color material colour material design

24/04 2016

dev-develop

dev-develop https://github.com/marijnvdwerf/material-palette-php

Prominent image colour extraction for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

image palette material-design color material colour material design

24/04 2016

1.1.1

1.1.1.0 https://github.com/marijnvdwerf/material-palette-php

Prominent image colour extraction for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

image palette material-design color material colour material design

23/04 2016

1.1.0

1.1.0.0 https://github.com/marijnvdwerf/material-palette-php

Prominent image colour extraction for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

image palette material-design color material colour material design

01/06 2015

1.0.0

1.0.0.0 https://github.com/marijnvdwerf/material-palette-php

Prominent image colour extraction for PHP

  Sources   Download

MIT

The Requires

 

The Development Requires

image palette material-design color material colour material design

21/05 2015

0.1.0

0.1.0.0

  Sources   Download

The Requires

 

19/05 2015

0.0.1

0.0.1.0

  Sources   Download

19/05 2015

0.0.0

0.0.0.0

  Sources   Download