rydmike / flex_color_picker

A highly customizable Flutter color picker.
BSD 3-Clause "New" or "Revised" License
200 stars 42 forks source link

Outside color wheel does not trigger color selection when on white/black or any shade of grey #88

Closed adamkoch closed 5 months ago

adamkoch commented 6 months ago

A bit of a strange issue - clicking on the color wheel does not trigger the correct color selection (onColorChanged) when the currently selected color is black/white or any shade of grey. The center square box does change accordingly though.

If any other color is already selected, then clicking the color wheel does trigger color selection correctly.

This can be reproduced on the web version: https://rydmike.com/flexcolorpicker/

Here is a recording of my own app. The "selected color preview" is set by setState with the onColorChanged:

https://github.com/rydmike/flex_color_picker/assets/869261/71b013fb-36a0-4ee7-b316-40554aa8f915

rydmike commented 5 months ago

Hi @adamkoch, what you are seeing is correct and expected behavior.

If you set color to a pure grey scale value (anything on the left side side), or white (upper left corner), or black, entire bottom side, your color selection has no chroma (no color in it). Thus when you change the hue (color on the color wheel), it has no impact on the produced RGB color value, since there is no color in the resulting RGB color value and the RGB color value is the same regardless of what Hue you use. As soon as you move away a bit from these edges, the RGB value will change.

adamkoch commented 5 months ago

Ah interesting! Thanks for the explanation - that makes a lot of sense given it's a hue ring and there is no hue to change.

Thanks for the response and for the library as well!