@tom_l Thanks for this example. I created a flood warning map using the Environment Agency integration and while I could get the levels to show on a map, changing the colour of the value based on the flood level would have been even better. I tweaked your example and managed to get it to work in my example.
Not being knowledgeable of this sort of thing, I’m not sure what the float(0) element does but I left it as the same and it seems to work a treat.
State values are strings. Before you can do mathematical operations like greater than or less than you need to convert them to numbers.
|float converts to a floating point number |int converts to an integer
The numbers in brackets after it are the default value that will be used if the state value can not be converted to a number. See: Templating - Home Assistant