thephpleague / color-extractor

Extract colors from an image like a human would do.

Home Page:thephpleague.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request: is it possible for the library to offer sorting the colours light to dark?

u01jmg3 opened this issue · comments

  • Is it possible for the library to offer sorting the colours light to dark?

e.g. https://gist.github.com/alexkingorg/2158428

Have you tried using ksort on getIterator() return?

Sorry for the slow reply.

How would I use that with this?

$image_path = 'cv.png';
$palette    = Palette::fromFilename($image_path);
$colours    = $palette->getMostUsedColors(6);

Convert colors into HSL color space and then you'll be able to sort them by L.
Such a functionality is outside the scope of this lib.