SVG Rating widget genraing

I want a widget as shown in the image for HTML page with canvas or SVG (prefer). I want some simple and straight forward code for this. The biggest problem is how to generate a dynamic arc showing two colors (as in the image).

Thanks in advance.