Change icing color based on another entity state

Hi! I’ve been trying for a week to configure an entity icon to change color based on another entity state. I have a switch with tree functions; on/off, power and power meter. When arriving home I would like my switch icon card to change border color and when the power is more than 0 Watt the icon to change color.
/A