Strange behavior of custom button card

I have a few custom:button-cards in a horizontal stack card.
They use a template

- card_type: horizontal-stack
        type: custom:hui-element
        cards:
          - type: custom:button-card
            template: icon_button
            entity: input_boolean.trigger_br_standing
            icon: mdi:floor-lamp-outline
            color: yellow
            name: Floor
            tap_action:
              action: toggle
          - type: custom:button-card
            color: blue
            name: null
          - type: custom:button-card
            color: blue
            name: null
          - type: custom:button-card
            template: icon_button
            entity: input_boolean.trigger_br_bed
            icon: mdi:desk-lamp
            color: magenta
            name: Bedstand
            tap_action:
              action: toggle

The template for the icon_button is as follows

icon_button:
    aspect_ratio: 4/3
    color_type: label-card
    hold action:
      action: none
    layout: vertical
    show_label: false
    show_name: true
    show_state: false
    styles:
      card:
        - border-radius: 10px
        - border: solid 1px var(--primary-color)
        - box-shadow: none
        - padding: 6px 6px
        - margin: 0px 0px
        - '--paper-card-background-color': rgba(100, 100, 0, 0)
      icon:
        - width: 28px
      name:
        - justify-self: middle
        - align-self: end
        - font-size: 14px
        - padding: 0px 0px
        - color: var(--secundary-text-color)
    tap_action:
      action: call-service
    hold_action:
      action: call-service

When I click the button, the action is called correctly.
When the entity input_boolean.trigger_br_standing is ON, it gets the color yellow (as specified)
The first time the entity goes OFF, the button color changes to black
Then ON again for yellow
The second time the entity goes OFF, the button colow changes to the color of the card (which is set through card_mod style to darkslateblue)

What am I missing? Why does the button OFF color change every time i switch OFF
And if I have the dashboard open on another device (phone, PC) then the color of the button on that device may be different from the first device, but it also changes every time the entity goes OFF.

I have noticed that while working on the buttons in the code-editor, when the left side of the window is the text editor and the right side of that window is a preview.
The preview works correct (I mean as I expect it to work, entity ON yellow, entity OFF color of the panel that the button is on.

Floor and Bedstand are both OFF
4 Spot is ON, 2Spot is OFF, Stars is OFF