openhab/openhab-core

[Rfc] Rewrite ColorUtil based on java.awt.color

andrewfg opened this issue · 1 comments

As mentioned in #4102 there seem to be some unexpected results produced by ColorUtil.hsbToXy(). And during my research into it, I noticed that all the ColorUtil methods are based on handcrafted OH specific code. I also discovered that there are two external libraries (java.awt.color resp. java.awt.colorspace) which provide similar transforms to the methods in OH ColorUtil. So I was thinking to refactor our ColorUtil methods to use these external java.awt libraries. Such a change might make the color performance of lighting bindings a bit different than before; but such changes should be providing an overall improvement in the precision of color space transformations (rather than a degradation), so I think such a change may be worth it.

As you know I am the author of the Hue API v2 binding code, so I am very familiar with that. And so if I work on ColorUtil I am in a good position to keep any changes under control. And as Hue has probably the largest user base for lighting in OH, we could minimise any upset in the user community. Although nevertheless we would need to test it very extensively.

Any thoughts?

It seems that java.awt.color does to support sufficiently wide color spaces. So closing.