voorkant / voorkant-core

https://voorkant.org/
MIT License
2 stars 3 forks source link

RGB-sliders jump around (or: RGB sliders are not the right interface) #13

Closed Habbie closed 7 months ago

Habbie commented 9 months ago

I haven't found lights with rgb in supported_color_modes. Lights that say RGB on the box show up as xy in HA, which appears to mean https://en.wikipedia.org/wiki/CIE_1931_color_space - a 2D space (although adding brightness as a dimension makes it a 3D space again). The RGB (but not RGBW/RGBWW) lights in the demo: instance offer hs mode. If I read https://developers.home-assistant.io/docs/core/entity/light/#turn-on-light-device correctly, I think we can pretend hs and xy lights are RGB.

The HA docs don't say it explicitly (actually they do, see last link in previous paragraph), but a HA code comment does - HA converts from RGB to XY. I suspect it then converts back, and sends us the updated color, causing the sliders to jump.

This likely explains that sometimes when I move one dimension (say, G) another dimensions also jumps a bit.

The usual HA webinterface for coloured lights is a color circle. Most likely this is also the best one for us. The actual CIE shape might be easier to start with though, if we're building something ourselves. Even simpler would be to use https://docs.lvgl.io/8/widgets/extra/colorwheel.html, where HS becomes HS and V becomes, I think, brightness.

Habbie commented 7 months ago

@cyclops1982 got us a nice colorwheel (currently sitting in #46, but still), so I'm closing this