refact: wrap the property 'begin' and 'end' to object 'color'.

In order to extend more features, wrap the 'begin' and 'end' property to
object 'color', and update the demo.