color-thief-php icon indicating copy to clipboard operation
color-thief-php copied to clipboard

Can get the color ratio

Open songyongshuo opened this issue 5 years ago • 0 comments

Update file CMap.php:28

public function palette() {

$total = array_sum($this->vboxes->map(function ($x) {
    return $x['vbox']->count();
}));

return $this->vboxes->map(function ($vb) use ($total) {
    return array($vb['color'], intval($vb['vbox']->count() / floatval($total) * 100));
});

}

songyongshuo avatar Apr 30 '19 04:04 songyongshuo