bokub / rgb-light-card

💡 A Home Assistant card for RGB lights
MIT License
427 stars 24 forks source link

Improvement: highlight selected colour #20

Closed Ligio closed 4 years ago

Ligio commented 4 years ago

It would be great to highlight the selected colour in UI, for example with a shadow, or something just to show which colour has been selected

bokub commented 4 years ago

Well, that's a feature I wanted from the beginning, but I encountered an issue.

Suppose I call the light.turn_on service like this (using the card or not, it doesn't matter)

service: light.turn_on
service_data:
  entity_id: light.example_light
  hs_color: 
    - 200
    - 70

The light turns on with my selected color. However, If I look at the state of my light, here is what I see:

hs_color:
  - 200.112
  - 70.196

The values found in the state are not exactly equal to the ones I defined, which means I cannot really know if the current color is one from the card or not.


Something I could do is simply highlight the icon when it has been clicked, but that would disappear if you reload the page or see it on another device