thomasloven / lovelace-card-mod

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

Styling of rows with custom types stopped working #146

Closed ildar170975 closed 8 months ago

ildar170975 commented 2 years ago

My Home Assistant version: 2020.10.6

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

What I am doing: Trying to apply a style to a row (Entities card) with:

What I expected to happen: Styles are applied. Earlier it worked:

What happened instead: No styles applied.

Minimal steps to reproduce - for config-template-card:

type: entities
title: config-template (row)
entities:
  - type: custom:config-template-card
    entities:
      - sun.sun
    row:
      entity: sun.sun
      name: config-template
    style: |
      :host {
        color: green;
      }
  - type: custom:config-template-card
    entities:
      - sun.sun
    row:
      entity: sun.sun
      name: config-template
    style:
      hui-text-entity-row:
        $: |
          hui-generic-entity-row .text-content {
            color: orange;
          }

image

Error messages from the browser console: none


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

ildar170975 commented 2 years ago

Example for fold-entity-row. This code used to change value's color.

type: entities
entities:
  - type: custom:fold-entity-row
    card_mod:
      style:
        hui-text-entity-row:
          $:
            hui-generic-entity-row: |
              .text-content.pointer {
                color: red;
              }
        '#items':
          hui-text-entity-row:
            $:
              hui-generic-entity-row: |
                .text-content.pointer {
                  color: red;
                }
    head:
      entity: sun.sun
      name: common color
    padding: 15
    open: true
    entities:
      - entity: sun.sun
        name: common color
      - entity: sun.sun
        name: common color

изображение

DavidFW1960 commented 2 years ago

Is there a workaround for this? I am using decluttering card and template as well and it's disappeared. It's the one you helped me with a long time ago and now it's blank.

ildar170975 commented 2 years ago

Hi David, DM me about this card, will see if I can help

ildar170975 commented 1 year ago

Solved the problem at least for restriction-card:

      - type: entities
        entities:
          - type: custom:restriction-card
            row: true
            card:
              entity: sun.sun
              name: hui-simple-entity-row
              secondary_info: last-changed
            card_mod:
              style:
                hui-simple-entity-row $:
                  hui-generic-entity-row $: |
                    .text-content:not(.info) {
                      color: magenta;
                    }

image

Gonna check it for config-template-card & fold-entity-row then.

ildar170975 commented 1 year ago

Solved for fold-entity-row (case described here):

  - type: entities
    entities:
      - type: custom:fold-entity-row
        card_mod:
          style:
            div#head :first-child:
              $ hui-generic-entity-row $: |
                .info {
                  color: red;
                }
            div#items :first-child:
              $ hui-generic-entity-row $: |
                .info {
                  color: cyan;
                }
        head:
          entity: sun.sun
        padding: 15
        open: true
        entities:
          - entity: sun.sun
            name: common color
          - entity: zone.home
            name: common color
          - entity: sensor.processor_use
            card_mod:
              style:
                hui-generic-entity-row $: |
                  .info {
                    color: magenta !important;
                  }
          - entity: input_boolean.test_boolean
            name: common color

image

ildar170975 commented 1 year ago

So, currently cannot solve the 1st case with config-template-card (here)

ildar170975 commented 8 months ago

Closing the issue.

The example from the 1st post with config-template-card works:

type: entities
title: config-template (row)
entities:
  - type: custom:config-template-card
    entities:
      - sun.sun
    row:
      entity: sun.sun
      name: config-template
    card_mod:
      style: |
        :host {
          color: red;
        }
  - type: custom:config-template-card
    entities:
      - sun.sun
    row:
      entity: sun.sun
      name: config-template
    card_mod:
      style:
        div#card :first-child $ hui-generic-entity-row $: |
          .info {
            color: orange;
          }

image