If you want different color depending on values that will be very sensor specific, and out of scope of my simple script. I suggest adding a function by yourself that take care of that. Similar to how I did with sensor type for moisture, you should be able to apply the same principle to text color.
FWIW: I’ve used data URIs with base64 encoded PNGs to show images in scriptable widgets. See eg. data URI scheme - Wikipedia for more information. Basically convert your image to a data URI (there are many free online services to do this), then
let req = new Request('data:image/png;base64,....')
someStack.addImage(req.loadImage())
is it possible to print attributes of sensors? How?
I have a longer text that is stored in an attribute (due to size limits for sensors) and I would like to show that attribute in the widget.
[later edit] - I managed to print a hard-coded attribute. What would be the filter syntax to return the attribute with a name written in the “sensor.homeassistant_widget_text” array?
I assumed I detect attributes by removing all chars after and including the second dot in the string…