Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get dominance percentages for the palette? #25

Open
SeBsZ opened this issue Mar 21, 2016 · 3 comments
Open

Get dominance percentages for the palette? #25

SeBsZ opened this issue Mar 21, 2016 · 3 comments

Comments

@SeBsZ
Copy link

SeBsZ commented Mar 21, 2016

Would it be possible to get some sort of dominance percentage for each color returned in the palette, so I can choose the second most dominant color for example?

@ksubileau
Copy link
Owner

Possible maybe, but I don't really know how I can return these percentages without breaking the current API...
Any ideas ?

@wilsmex
Copy link

wilsmex commented Jul 7, 2018

I need this too. a relative percentage between 0 - 100 or 0 - 1 for each color returned. This way one could query for images with at least xx% of a particular color...

@realjoshharrison
Copy link

Possible maybe, but I don't really know how I can return these percentages without breaking the current API... Any ideas ?

How about a new option for $outputFormat such as 'detailed'?

ColorThief::getColor could then return something like:

[
  'color' => $colorInstance, // ColorThief\Color instance – can get preferred colour format from this
  'percentage' => 0.2, // colour dominance
]

And ColorThief::getPalette would return an array of these arrays..?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants