Using clones in Inkscape:
an application to creating labels for SVNmate

“Clones” are the way Inkscape exposes a very powerful feature of SVG: the use element. It allows an object to mirror (i.e. be the clone of) any other SVG entity (be that a simple path, rectangle, group, inserted bitmap etc.).


For example, the first element is a red rectangle and the second it its clone



Why this is powerful will be demonstrated in the following example hopefully. I wanted to create colored folder badges for SVNMate, a TextMate plugin which shows the SVN status of files in a project (up to date, modified, deleted, etc.). I used Inkscape for this and created a series of bookmark-like labels which are included with the updated version of SVNmate. I also designed a simpler set, based on Aqua colors (download it here and follow Ciarán’s instructions for installation).

As the image shows, the document contains many repetitions of the same basic object, with different styles. This type of document cries out loud for clones: they allow to modify the shape of the original object once and to see this change mirrored in real time by its clones. Handy. But things can even be made more useful when styles are gracefully inherited too. Here follow step by step instructions to create the bookmarks badges included with SVNmate.

Illustration Instructions
Start by creating a shape, with unset fill and stroke. Unset fill appears as black and unset stroke does not appear.
Clone it [⌥D]
Duplicate this clone two times [⌃D]. In effect that creates two more clones of the original object in 1. Group these three clones together [⌃G].
Apply some styles to some of the clones. The left most has a grey fill and is blurred. The rightmost has a liner gradient fill from black to complete transparent. Black means the actual black color, not unset. The fact that unset appears as black is purely coincidental here (that’s just the way the SVG standard states it should be).
Superpose the clones. The leftmost is behind, the right most is in front. Move the blurred one down a little to fake a shadow.
Exit from the group (double click outside) and clone the entire group (⌥D).
On each one of the cloned group, you can apply a fill color. In a regular group, the fill color would be inherited by all group members. Since those are clones, they can inherit the color only if their fill is unset. This is the case for the middle object only. The other keep their own style and the shadow effect is hence present on all colored clones. You can easily create many clones from the group in 2 and color them differently.
Then you’ll only need to change the original once and the changes will be reflected immediately in all the cloned badges. For example for a more cartoonesque look, the shape can be made curlier and a border can be added to the original.

Of course, this is not state-of-the-art design but it shows how useful clones can be, and hopefully will inspire some real designers. And when you’ll feel inspired, try tiling clones and be amazed.

One last tip about an upcoming Inkscape 0.46 feature. Your clones, as any object, can be exported individually to PNG images. Once you have exported an object, Inkscape keeps the path to which it was exported as a property of the object. Hence you can re-export it in a breeze. This comes really handy when you need to export several objects repeatedly. In the development version of Inkscape, you can select all your clones, bring forward the export dialog [⇧⌃E], check the magic “Batch export x selected objects” and export them all to their correct filenames in one go. Oh, I love Inkscape!

2 Responses to “Using clones in Inkscape:
an application to creating labels for SVNmate”


  • Very nice. You could talk about automatically changing the colour in a pattern of clones if you know how. That would be a cool topic.

  • Stefaan Lippens

    Very nice illustration of some inkscape features I should use more.

    One problem I’ve encountered however (with Inkscape 0.46) is that if you move object 1 from your illustration, the gradient control nodes in object 2 also move (in the opposite direction).

Leave a Reply