thomasloven / lovelace-card-mod

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

Gradient transitions don't smoothly change with @property #203

Closed teflocarbon closed 1 year ago

teflocarbon commented 2 years ago

My Home Assistant version: 2022.5.5

My lovelace configuration method (GUI or yaml): GUI

What I am doing: Trying to use @property to transition a gradient

What I expected to happen: The gradient transitions smoothly as it does so in Codepen

What happened instead: The gradient does not transition smoothly and jumps to the other gradient with no transition.

Minimal steps to reproduce:

# The least amount of code possible to reproduce my error
type: entities
style: |
  }
  h1.card-header {
    padding: 10px;
    margin-top: -4px
  }
  #states {
    padding: 10px;
  }
  @property --lemons {
    syntax: '<color>';
    inherits: false;
    initial-value: red;
  }
  ha-card {
    background: radial-gradient(var(--lemons),blue);
    transition: all 3.0s;
    {% if is_state('light.pikachu_lamp','on') %}
    --lemons: red;
    {% else %}
    --lemons: blue;
    {% endif %}
  }
# End of code

Error messages from the browser console: N/A


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

Olegz73 commented 2 years ago

+1 have the same trouble after last update.

ildar170975 commented 2 years ago
  1. What card are you trying to style? It is not specified in the issue.

  2. Regarding this:

    style: |
      {
        padding: 0px;
      }

    Where is a selector for this style?

thomasloven commented 1 year ago

The codepen doesn't transition smootly either if you change

transition:--c 0.5s;

to transition: all ...