-
-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ColorUtil for better support of xyY conversion #3434
Conversation
assertEquals(14.65, xy[0].doubleValue(), 0.01); | ||
assertEquals(11.56, xy[1].doubleValue(), 0.01); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These colors are nearly the same. Using e.g. https://www.easyrgb.com/en/convert.php#inputFORM to convert both colors to HTML color code results in #021645
and #001849
which is very close.
In general this test could be removed since it is part of the ColorUtilTest
in a similar way.
This has been refactored to align with the usually used conversion by a lot of ZigBee products like Hue or Deconz. Signed-off-by: Jan N. Klug <[email protected]>
} | ||
|
||
@Test | ||
public void testCreateFromXY() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed this test because it was invalid. The JavaDoc of HSBType.fromXY
states that the parameters should be between 0 and 1.
Thanks @J-N-K, I was preparing a PR as well, but of course you were faster and already included the HSBType.... 👍 |
bundles/org.openhab.core/src/main/java/org/openhab/core/util/ColorUtil.java
Show resolved
Hide resolved
bundles/org.openhab.core/src/main/java/org/openhab/core/util/ColorUtil.java
Show resolved
Hide resolved
bundles/org.openhab.core/src/main/java/org/openhab/core/util/ColorUtil.java
Outdated
Show resolved
Hide resolved
bundles/org.openhab.core/src/main/java/org/openhab/core/util/ColorUtil.java
Show resolved
Hide resolved
@kaikreuzer It would be helpful to include this PR in the first milestone build, as we would like to use it in addons.... |
@holgerfriedrich Ok. But it seems that you did some review comments, so I'll first wait for @J-N-K to resolve those. |
Signed-off-by: Jan N. Klug <[email protected]>
Signed-off-by: Jan N. Klug <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Just a remark: I am not sure if checking the range of x and y to be in 0..1 will break a binding implementation. Looking at the usage of HSBType.fromXY
it is hard to tell. EspMilightHubHandler looks a bit suspicious, as it scales up the values by 100.
If it does break something that should be fixed, because it was invalid before. |
@kaikreuzer I think everything is addressed now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, thank you.
@J-N-K |
Fixes for color test are missing for MQTT Things and Channels and TRÅDFRI Binding too. |
* Add ColorUtil for better support of xyY conversion This has been refactored to align with the usually used conversion by a lot of ZigBee products like Hue or Deconz. Signed-off-by: Jan N. Klug <[email protected]> GitOrigin-RevId: a32f1e0
This has been refactored to align with the usually used conversion by a lot of ZigBee products like Hue or deconz.