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

Field method toColor('average') returns the dominant color in extract mode => 'both' #15

Closed
houdini-rites opened this issue Jan 25, 2022 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@houdini-rites
Copy link

I am using 'sylvainjule.colorextractor.mode' => 'both' to extract both the dominant and the average color.

It seems to work and $image->color() returns a comma-separated list with both colors:

Kirby\Cms\Field Object
(
    [color] => #5F99A5,#7B8992
)

However when I try using the field methods $image->color()->toColor('dominant') and $image->color()->toColor('average') I only get the dominant color as a result in both cases.

@sylvainjule sylvainjule self-assigned this Feb 23, 2022
@sylvainjule sylvainjule added the bug Something isn't working label Feb 23, 2022
@sylvainjule
Copy link
Owner

sylvainjule commented Feb 23, 2022

Unfortunately I cannot reproduce this, it works as intended in my projects.
What is the Kirby version?

@sylvainjule sylvainjule added the needs: information Additional details are needed label Feb 23, 2022
@houdini-rites
Copy link
Author

Hi, I am using Kirby 3.6.2.

I looked again and figured out that I only encounter this issue when hananils's kirby colors is in the plugins folder as well (I intended to use both plugins together).

Here is a demo: https://github.com/houdini-rites/color-extractor-test

For me with this setup $image->color()->toColor('dominant') and $image->color()->toColor('average') return two different colors only after I remove hananils's color picker plugin from the plugins folder.

I am not sure if this is an incompatibility issue or I am doing something wrong..

Thank you for looking into it!

@sylvainjule sylvainjule removed the needs: information Additional details are needed label Feb 24, 2022
@sylvainjule
Copy link
Owner

There is a conflict as the toColor method name is already used by hananils' plugin. I will change it.

@sylvainjule
Copy link
Owner

I have changed it, you should now use ->dominantColor() or ->averageColor().

@houdini-rites
Copy link
Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants