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

How to apply the "color" style to values? #71

Open
samoswall opened this issue Sep 22, 2021 · 1 comment
Open

How to apply the "color" style to values? #71

samoswall opened this issue Sep 22, 2021 · 1 comment

Comments

@samoswall
Copy link

В примерах описано как можно менять цвет значка в зависимости от значения датчика:
The examples describe how you can change the color of the icon depending on the sensor value:

- type: custom:mini-humidifier
  entity: fan.xiaomi_miio_device
  indicators:
    depth:
      icon:
        template: >
          (value) => {
            if (value === 0)
              return "mdi:tray";
            if (value <= 20)
              return "mdi:tray-minus";
            return "mdi:tray-full";
          }
        style: >
          (value) => {
            if (value === 0)
              return { color: "red" };
            if (value <= 20)
              return { color: "#FD451D" };
            return {};
          }

Это можно сделать для значков температуры и влажности (например: t<=20 синий цвет, 20<t<30 зеленый цвет, t>=30 красный цвет)
This can be done for temperature and humidity icons (for example: t<=20 blue, 20<t<30 green, t>=30 red)

Как прописать правило для изменения цвета текста значения? (цифры)
How do I write a rule for changing the color of the text value? (numbers)

@Krocko
Copy link

Krocko commented Nov 12, 2021

This option don’t work anymore for my too.
The last working version was 2.4.1.

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

2 participants