## Extending functionality
Svg.js has a modular structure. It is very easy to add you own methods at different levels. Let's say we want to add a method to all shape types then we would add our method to SVG.Shape:
+
```javascript
SVG.extend(SVG.Shape, {
});
```
-Now all shapes will have the paintRed method available. Say we want to have the paintRed method on a circle apply a slightly different color:
+
+Now all shapes will have the paintRed method available. Say we want to have the paintRed method on an ellipse apply a slightly different color:
+
```javascript
-SVG.extend(SVG.Circle, {
+SVG.extend(SVG.Ellipse, {
paintRed: function() {
return this.fill({ color: 'orangered' });
}
});
+
```
-The complete inheritance stack for `SVG.Circle` is:
+The complete inheritance stack for `SVG.Ellipse` is:
-_SVG.Circle < SVG.Shape < SVG.Element_
+_SVG.Ellipse < SVG.Shape < SVG.Element_
The SVG document can be extended by using:
```javascript
+
SVG.extend(SVG.Doc, {
paintAllPink: function() {