Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

primary-text-color no longer working? #356

Open
4 tasks done
walk0080 opened this issue Feb 1, 2024 · 8 comments
Open
4 tasks done

primary-text-color no longer working? #356

walk0080 opened this issue Feb 1, 2024 · 8 comments

Comments

@walk0080
Copy link

walk0080 commented Feb 1, 2024

My Home Assistant version: Core 2024.1.6 | Frontend 20240104.0

My lovelace configuration method (GUI or yaml): yaml

What I am doing:

Setting primary text colour as red or green.

What I expected to happen:

Certain text should be colour coded green (for yes) and red (for no).
This was working yesterday. Seems to be an issue on iOS/iPadOS Companion App, mobile and desktop browsers.

What happened instead:

As of today, the text just stays white and does not change based on state.
Not sure if this is specifically an issue with card-mod, or mushroom-template (both are using latest versions installed via HACS).

Minimal steps to reproduce:

Loaded up HA in Companion App this morning and text colours no longer change.

# The least amount of code possible to reproduce my error
          - type: custom:mushroom-template-card
            primary: |-
              {% set state=states('input_boolean.dog_henry_feeding_required') %}
              {% if state=='on' %}
                Yes
              {% else %}
                No
              {% endif %}
            secondary: Feed Reqd?
            icon: ''
            entity: input_boolean.dog_henry_feeding_required
            icon_color: white
            tap_action:
              action: more-info
            hold_action:
              action: more-info
            double_tap_action:
              action: more-info
            multiline_secondary: false
            fill_container: false
            card_mod:
              style:
                mushroom-state-info $: |
                  .container {
                    --card-secondary-font-size: 14px;
                    --card-primary-font-size: 16px;
                  }
                .: |
                  ha-card {
                    {% set state=states('input_boolean.dog_henry_feeding_required') %}
                    {% if state=='on' %}
                      --primary-text-color: red
                    {% else %}
                      --primary-text-color: green
                    {% endif %}
                    }
# End of code

Error messages from the browser console:

No errors in HA logs or in Chrome browser Console.

Was able to get a screen cap from phone before it refreshed:
IMG_1727

Screen cap from tablet this morning:
IMG_1794


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

  • Understand that this is a channel for reporting bugs, not a support forum (https://community.home-assistant.io/).

  • Have made sure I am using the latest version of the plugin.

  • Have followed the troubleshooting steps of the "Common Problems" section of https://github.com/thomasloven/hass-config/wiki/Lovelace-Plugins.

  • Understand that leaving one or more boxes unticked or failure to follow the template above may increase the time required to handle my bug-report, or cause it to be closed without further action.

@ildar170975
Copy link
Contributor

What are these "*" used for?

            fill_container: false
            **card_mod:
              style:

@walk0080
Copy link
Author

walk0080 commented Feb 1, 2024

What are these "*" used for?

            fill_container: false
            **card_mod:
              style:

Those showed up after pasting... should not be there. Updated original post.

@ildar170975
Copy link
Contributor

ildar170975 commented Feb 1, 2024

You are facing the issue with a custom card.
Suggest to re-test with a standard Entities card.
If the variable works there - means there is smth wrong either with the custom card or your card-mod code.

@walk0080
Copy link
Author

walk0080 commented Feb 1, 2024

You are facing the issue with a custom card. Suggest to re-test with a standard Entities card. If the variable works there - means there is smth wrong either with the custom card or your card-mod code.

As far as I am aware, I can't use "--primary-text-color" on a standard HA card to test?

Reality is that the code was working fine yesterday and for weeks prior without any changes made to the code. Also posted on the lovelace-mushroom Github: 1355

@ildar170975
Copy link
Contributor

I can't use "--primary-text-color" on a standard HA card to test?

Surely you can:

type: entities
entities:
  - sun.sun
card_mod:
  style: |
    ha-card {
      --primary-text-color: magenta;
    }

image

So, this is about Mushrooms - and not a card-mod issue.

@walk0080
Copy link
Author

walk0080 commented Feb 1, 2024

Thank you for your time - I must have made a typo when I tried a moment ago with a standard card. Does in fact work... will see what I get on the mushroom Github side.

type: entity
entity: input_boolean.dog_henry_feeding_required
card_mod:
  style: |
    ha-card {
      {% set state=states('input_boolean.dog_henry_feeding_required') %}
      {% if state=='on' %}
        --primary-text-color: red
      {% else %}
        --primary-text-color: green
      {% endif %}
      }

IMG_1796

@rindlerblabla
Copy link

The format should be according to this post. piitaya/lovelace-mushroom#1348 (comment). Think this issue could be closed.

@avw2304
Copy link

avw2304 commented Mar 17, 2024

Can someone help me with a similair issue?
I would to color the first temperature, preferred any value above 15.
In the past it was working, but stopped working after the update

`type: custom:stack-in-card
cards:

  • type: custom:stack-in-card
    cards:
    • square: false
      columns: 2
      type: grid
      cards:
      • type: custom:mushroom-template-card
        primary: Woonkamer
        secondary: |-
        {{states('sensor.verwarming_woonkamer_ingestelde_temperatuur') |
        round(1) }} °C | {{states('sensor.woonkamer_temperature') |
        round(1) }} °C
        card_mod:
        style: |
        ha-card {
        {% set state=states('sensor.verwarming_woonkamer_ingestelde_temperatuur') %}
        {% if state=='21.0' %}
        --primary-text-color: red
        {% else %}
        --primary-text-color: inherit
        {% endif %}
        }
        icon: >-
        {% if is_state_attr('climate.woonkamer','hvac_action', 'heating')
        %}
        mdi:fire
        {% else %}
        mdi:fire
        {% endif %}
        entity: climate.woonkamer
        icon_color: >-
        {% if is_state_attr('climate.woonkamer','hvac_action', 'heating')
        %}
        red
        {% else %}
        grey
        {% endif %}
        multiline_secondary: false
        layout: horizontal
        fill_container: true
        tap_action:
        action: more-info
        hold_action:
        action: more-info`

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants