martin-stone / hsv-alpha-color-picker-android

A color picker and a color preference for use in Android applications.
Apache License 2.0
290 stars 60 forks source link

Setting color with low brightness leads to different colors #49

Closed JulianEggers closed 5 years ago

JulianEggers commented 5 years ago

When setting the color picker to a low brightness (<=0.01) the hue and sat values of the ObservableColor start to change.

For example calling: colorPickerView.setColor(Color.HSVToColor(new float[]{80f, 0.6f, 0.01f})); Leads to Hue: 60.0, Sat: 0.5, Bri: 0.007843138 from the color observer.

Lowering the brightness even more results to completely different hue and sat results: Setting Hue: 80, Sat: 0.6, Bri: 0 leads to Hue: 0, Sat: 0, Bri: 0.

This issue is caused by: Color.colorToHSV(color, hsv); (ObservableColor:93) Somehow the Color library is not able to work properly with low brightness values.

Possible solution: Introduce new method setColor(hue, sat, bri) to ColorPickerView that does not rely on the color library?

martin-stone commented 5 years ago

Now published as 3.0.1. Thanks!

JulianEggers commented 5 years ago

Version 3.0.1 works well. Thank you for the opportunity to contribute to this project.

Btw: Just saw that the Version 3.0.1 commit and release is missing. (In case you forgot it.)

martin-stone commented 5 years ago

Ah, yes. Forgot to push!