cyotek / Cyotek.Windows.Forms.ColorPicker

Color picker control suite for Windows Forms applications.
http://cyotek.com/blog/tag/colorpicker
MIT License
149 stars 41 forks source link

if Color=Color.Black ColorPickerDialog doesn't work correctly #38

Open Charltsing opened 2 years ago

Charltsing commented 2 years ago
 ColorPickerDialogDemoForm.cs  --->  BrowseColorButton_Click
 Color = Color.FromArgb(255, 0, 0, 0)

ColorPickerDialog doesn't work correctly。

 HslColor hc = new HslColor(Color.FromArgb(255, 0, 0, 0));
 if (hc.L == 0) hc.L = 0.5;   
 Color color = hc.ToRgbColor();

ColorPickerDialog works fine.

ColorPickerDialog does not support Color.Black?

cyotek commented 2 years ago

I'm not entirely sure what you're reporting - when you say it doesn't work correctly, what do you mean?

The following observations apply to the version 2, currently in beta. If you're using a different version let me know.

In the ColorPickerDialog, changing a colour via the wheel no longer resets the Lightness value as it used to, instead it keeps the current value. As black has a lightness of zero, that means when using the wheel all colours will appear as black, until you change the lightness slider anyway. It works in reverse too, I'd already seen it when using pure white.

As your second example changes the lightness from 0 to 0.5, this is retained by the wheel for the colours it creates.

While I know the behaviour is confusing I haven't thought of a better way to resolve it yet, or even if it needs resolving - I have seen other colour pickers behave the same way.

Charltsing commented 2 years ago

changing a colour via the wheel no longer resets the Lightness value as it used to, instead it keeps the current value.

Can I customize this behavior? reset or no reset Lightness value