@konradwalsh said in MMM-Rest:
Is it possible to create an in-line if statement to control the formatting?
So, if the result, say @1 > 10 then color:red else color:green
At a first look, I would suggest to change the “format:” parameter in “sections” to support something like that:
[
{ range:[0, 10], format: ' span style="color: yellow"%d /span' },
{ range:[10, undef], format: 'span style="color: red"%d /span' },
{ format: 'span style="color: green"%d /span' },
]
and to traverse the array and the first entry which matches wins. “undef” could mean “don’t care about this value” and an entry without range could be the “default” (which has to be the last entry).
What is your opinion: could this solve your problem?
Edit: HTML-Tags where removed by the forum system… Code above should be correct HTML of course