Graphic colors will change when the data changes

Hello, does anyone know how the graphic colors will change when the data changes. I am using Misol soil moisture sensors. Then I would like the graphic to change from green (or blue) to yellow, then to red color at a certain set percentage.

Different colors must be possible like the picture below. But I can’t find how

That picture is not generated by a flow, but by a special piece of code, so it is not available for end users.