question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Strange icon dimension after updating to HA 0.109.0b0

See original GitHub issue

Checklist

  • I updated the card to the latest (stable) version available
  • I cleared the cache of my browser

Describe the bug Since I upgraded to HA 0.109.0b0 the icons in some of my custom button card behave strangely. I use the state of the button to display a timer. When the timer is active the font is 9px and when the timer is idle the font is 0px. The icon dimension used to adapt, so in HA 0.108.8 I had

image

respectively when the timer is off and on In 0.109.0b0 I have this:

image because the icon remains the same (too tiny) dimension.

Version of the card Version: 3.2.3

To Reproduce This is the configuration I used:

              - type: custom:button-card
                entity: timer.taverna
                icon: mdi:lightbulb
                name: taverna
                tap_action: 
                  action: call-service
                  service: light.toggle
                  service_data:
                    entity_id: light.luce_taverna
                hold_action: 
                  action: call-service
                  service: automation.toggle
                  service_data:
                    entity_id: automation.luce_taverna_spegni_su_fine_timer
                show_state: true
                show_name: true
                show_icon: true
                color_type: icon

                styles:
                  img_cell:
                    - justify-content: middle
                    - align-items: middle
                    - margin: none 
                  state:
                    - font-size: >
                          [[[
                             if (states['timer.taverna'].state == 'idle')
                              return "0px";
                             else
                              return "9px";
                          ]]]

                  card:
                  - height: 64px
                  icon:
                    - color: >
                          [[[
                             if (states['light.luce_taverna'].state == 'on')
                              return "var(--paper-item-icon-active-color)";
                             return "var(--paper-item-icon-color)";
                          ]]]
                  grid:
                    - position: relative
                    - grid-template-areas: '"i" "s" "n" "l"'

Desktop (please complete the following information):

  • Browser [e.g. chrome, safari]: chrome
  • Version [e.g. 22] latest

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]: Iphone 8
  • OS: [e.g. iOS8.1] iOS 13.4
  • Browser [e.g. stock browser, safari] chrome and safari
  • Version [e.g. 22] latest

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11

github_iconTop GitHub Comments

1reaction
ArkadiuszNiemieccommented, May 13, 2020

I have just updated to 0.110.* and have similar problem. My icons are now way smaller and not vertically centred:

Capture

                        - type: 'custom:button-card'
                          entity: switch.kitchen_wall_right # button kitchen
                          icon: 'mdi:stove'
                          show_icon: true
                          show_name: false
                          state:
                            - styles:
                                icon:
                                  - color: 'var(--paper-item-icon-active-color)  '
                              value: 'on'
                          styles:
                            card:
                              - height: 70px
                              - border-radius: 4px
                              - background-color: var(--primary-background-color)
                            icon:
                              - width: 80%
                              - color: var(--primary-text-color)
                          tap_action:
                            action: toggle
                            haptic: light
                          hold_action:
                            action: more-info

The height in icon style normally set the icon size, and they were centred by default. I have found that the ha-svg-icon element has these properties:

width: var(--mdc-icon-size, 24px);
height: var(--mdc-icon-size, 24px);

But what about centring? @RomRider can you please check what they changed?

Edit: @RomRider this is how it looks on 0.109.6:

Capture

Edit2: 0.110.* is not stable yet. I will stick to stable release.

0reactions
mgiakocommented, May 15, 2020

Hi, the problem is back on HA 0.110.0b2. Have I to open a new issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Icons randomly change sizes. - Microsoft Community
Why do the icon sizes load inconsistently after updates, crashes, or cache rebuilds and is there an actual fix? This thread is locked....
Read more >
Strange Problem with AppleTV icon - Stack Overflow
When you roll over the icon, the iml becomes 1/2 size and sits top right, and the rest of the icon area is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found