本帖最后由 relliky 于 2023-9-11 06:31 编辑
做出来了,仿ios16的开灯变白,关灯变黑
代码如下
type: custom:mushroom-light-card
fill_container: true
use_light_color: true
show_brightness_control: true
show_color_control: true
show_color_temp_control: true
collapsible_controls: false
name: ' Lamp 1'
icon: ''
entity: light.master_room_lamp_1
card_mod:
style: >
:host {
--ha-card-background: {% if states(config.entity) in ['on'] %}
rgba(245, 245, 245, 0.7)
{% else %}
rgba(10, 10, 10, 0.4)
{% endif%};
--primary-text-color: {% if states(config.entity) in ['on'] %}
black
{% else %}
white
{% endif%};
--secondary-text-color : {% if states(config.entity) in ['on'] %}
rgba(100, 100, 100, 1)
{% else %}
rgba(220, 220, 220, 1)
{% endif %};
}
ha-card > mushroom-card > div > mushroom-button:nth-child(2) {
--bg-color: {% if states(config.entity) in ['on'] %}
rgba(245, 245, 245, 0.4)
{% else %}
rgba(10, 10, 10, 0.4)
{% endif %};
}
ha-card > mushroom-card > div > mushroom-button:nth-child(3) {
--bg-color: {% if states(config.entity) in ['on'] %}
rgba(245, 245, 245, 0.4)
{% else %}
rgba(10, 10, 10, 0.4)
{% endif %};
}
感谢指点。还不够像ios16,再琢磨一下把icon颜色弄一下, 各个颜色还需要调整一下。不过那个等下周末再弄吧,可以睡觉咯
|