Nerwyn/service-call-tile-feature

Selector doesnt respond to color settings

Closed this issue · 2 comments

Hi,

I tried the new Beta today, as a first time user of the service call tile plugin.

I tried to make a selector button group, but unfortunaltely after selecting a button the white icon is on a white button background so the icon is no longer visible. Any attempt to change icon or button color make no effect whatsoever.

Here is my YAML:

          - type: tile
            entity: input_select.sceneval_hela_lagenheten
            icon: mdi:home
            name: Hela lägenheten
            features:
              - type: custom:service-call
                entries:
                  - type: selector
                    style:
                      '--color': rgb(124,56,74)   
                      height: 100px
                    options:
                      - icon: mdi:lightbulb-on-10                 
                        option: Mysbelysning
                        style:
                          '--color': rgb(124,56,74)  
                        icon_style:
                          color: rgb(37, 79, 55)  
                        tap_action:
                          action: call-service
                          service: script.hela_lagenheten_mysbelysning
                      - icon: mdi:lightbulb-on-10
                        option: Normalbelysning
                        tap_action:
                          action: call-service
                          service: script.hela_lagenheten_normalbelysning
                      - icon: mdi:lightbulb-on
                        option: Maxbelysning
                        tap_action:
                          action: call-service
                          service: script.hela_lagenheten_stadbelysning
                      - icon: mdi:lightbulb-off
                        option: Släckt
                        tap_action:
                          action: call-service
                          service: script.hela_lagenheten_slackt

Before I click any button, it looks nice:

image

But after clicking, i no longer see the icon of the clicked button:

image

Is this a bug or do i do something wrong?

By using the GUI editor, i finally got it to generate YAML that actually did reconfigure the button colors, so the problem is now solved:

          - features:
              - type: custom:service-call
                entries:
                  - type: selector
                    options:
                      - icon: mdi:lightbulb-on-10
                        option: Mysbelysning
                        tap_action:
                          action: call-service
                          service: script.hela_lagenheten_mysbelysning
                          target:
                            entity_id: input_select.sceneval_hela_lagenheten
                        type: button
                        styles: |-
                          :host {
                            --color: rgb(127,127,127) !important;
                          }
                          .icon {
                            color: rgb(255, 179, 55) !important;
                          }
                        entity_id: input_select.sceneval_hela_lagenheten
                        value_attribute: state

As you've found out, styles have been reworked to use the HTML style tag and accept a CSS string instead of YAML. You can set icon color either using --icon-color in host or .icon, or color in icon.

The white background and icon is a result of your tile card color being white. You have to either change that or the icon color, as you've done.