WindowsCommunityToolkit icon indicating copy to clipboard operation
WindowsCommunityToolkit copied to clipboard

ColorPicker Bottom Shade Adjuster Resets Color to White

Open zateutsch opened this issue 2 years ago • 5 comments

Describe the bug

Using the bottom shade adjuster while on the darkest shade resets the selected color to white.

  • [ ] Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:

Steps to Reproduce

  • [x] Can this be reproduced in the Sample App? (Either in a sample as-is or with new XAML pasted in the editor.) If so, please provide custom XAML or steps to reproduce. If not, let us know why it can't be reproduced (e.g. more complex setup, environment, dependencies, etc...)

Steps to reproduce the behavior:

  1. Reproduced in the Sample App as-is
  2. Using box-shaped spectrum color picker, select any color on the spectrum
  3. Lower shade value to darkest shade using either bottom or left shade control
  4. Update to lighter shade value using bottom control.
  5. Color resets to white.

Expected behavior

Updating to lighter shade using the bottom control maintains the latest used color, instead of reverting to white.

Screenshots

image image image

zateutsch avatar Aug 31 '21 20:08 zateutsch

Hello zateutsch, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

ghost avatar Aug 31 '21 20:08 ghost

Thanks @zateutsch, I had mentioned this to @robloo before during the initial review. I don't think the memory tracking is on his feature board in #3643, so good to have an issue tracking it. Putting out to next milestone for now.

michael-hawker avatar Aug 31 '21 20:08 michael-hawker

Yea, this was called out before. Thanks for pointing this out in real-world usage.

I did initially think this needs to be fixed by remembering the last color before white. However, just operating in HSV should be enough (and a lot easier / more elegant). The Hue doesn't change in the bottom preview and accent colors area (it behaves just like a Value-channel slider with 5 discrete steps). This means the information is preserved if only HSV was being used instead of RBG.

I will have to change the converter to operate in HSV and this could be a larger tear up in this area. But all this information is internal to the ColorPicker anyway.

Bottom line: It should be fixable without remembering the color: Just switching from RGB to HSV color representation should be enough.

robloo avatar Sep 01 '21 00:09 robloo

This was fixed in an internal version of the control.

  1. A new ColorPreviewer control was added to handle the bottom color preview area as well as the accent colors (this helps clean up and simplify ColorPicker code while making feature additions simpler)
  2. As mentioned above, the ColorPreviewer now works in HSVA color representation instead of RGBA. That preserves Hue information even in min/max Saturation. In practice that means the slider never gets reset to white/black and you can always step back into the color hue selected in the spectrum.

It's only a matter of copying over the code so it shouldn't be too much trouble to fix.

robloo avatar Feb 27 '22 20:02 robloo

Fixed in #4502

robloo avatar Mar 05 '22 18:03 robloo