thomasloven / lovelace-card-mod

🔹 Add CSS styles to (almost) any lovelace card
MIT License
1.04k stars 169 forks source link

Static icon color in basic cards not surviving HA restart or charging of cache. After some use of HA, the icon color works. I've tried coding the icon color in a few ways, same result. Please note, the same card-mod on mushroom cards work as expected. #378

Open cableghost opened 1 month ago

cableghost commented 1 month ago

My Home Assistant version: 2024.5.5

My lovelace configuration method (GUI or yaml): yaml, thru GUI

What I am doing: Coding static icon color

What I expected to happen: Icon color to be as I coded

What happened instead: No color change

Minimal steps to reproduce: Restart HA or clear cache, start fresh

type: horizontal-stack
cards:
  - show_name: true
    show_icon: true
    type: button
    icon: mdi:palette
    tap_action:
      action: toggle
    entity: script.scene_blue
    name: Blue
    card_mod:
      style: |
        ha-card {
          --paper-item-icon-color: blue;
        }
  - show_name: true
    show_icon: true
    type: button
    icon: mdi:palette
    tap_action:
      action: toggle
    entity: script.scene_green
    name: Green
    card_mod:
      style: |
        ha-card {
          --paper-item-icon-color: green;
         }
  - show_name: true
    show_icon: true
    type: button
    icon: mdi:palette
    tap_action:
      action: toggle
    entity: script.scene_orange
    name: Orange
    card_mod:
      style: |
        ha-card {
          --paper-item-icon-color: orange;
         }
  - show_name: true
    show_icon: true
    type: button
    icon: mdi:palette
    tap_action:
      action: toggle
    entity: script.scene_red
    name: Red
    card_mod:
      style: |
        ha-card {
          --paper-item-icon-color: red;
         }

Error messages from the browser console:


By putting an X in the boxes ([]) below, I indicate that I:

ildar170975 commented 1 month ago
show_name: true
show_icon: true
type: button
icon: mdi:palette
tap_action:
  action: toggle
entity: script.test_script
name: Blue
card_mod:
  style: |
    ha-card {
      --paper-item-icon-color: blue;
     }

It is blue:

изображение

изображение

It MAY BE NOT blue in Editor since the Editor looses card-mod code (https://github.com/thomasloven/lovelace-card-mod/issues/337):

изображение

and after save it definitely NOT blue since card-mod code is deleted (i.e. not saved):

изображение

cableghost commented 1 month ago

If the card-mod code is deleted at some point, I'm unaware, as the code is there every time I go to edit the cards. It's a strange scenario and only occurs for me inside the basic horz panel card. The same code works as expected within mushroom cards.

ildar170975 commented 1 month ago

If your issue is only about "card-mod code is automatically deleted" - then this is a duplicate of https://github.com/thomasloven/lovelace-card-mod/issues/337. If not - suggest to add details since in my setup I see a color ALWAYS applied - if the card-mod code is NOT deleted.

cableghost commented 1 month ago

Thank you for your response. I really don't have any other evidence of this occurring. It must be a conflict with other code, somewhere.

On Tue, May 28, 2024, 9:35 PM ildar170975 @.***> wrote:

If your issue is only about "card-mod code is automatically deleted" - then this is a duplicate of #337 https://github.com/thomasloven/lovelace-card-mod/issues/337. If not - suggest to add details since in my setup I see a color ALWAYS applied - if the card-mod code is NOT deleted.

— Reply to this email directly, view it on GitHub https://github.com/thomasloven/lovelace-card-mod/issues/378#issuecomment-2136410035, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABKRN7YR2ULILEJWQ5T4RBTZEU5H3AVCNFSM6AAAAABIKCPKXOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZWGQYTAMBTGU . You are receiving this because you authored the thread.Message ID: @.***>