16.3 Styling Clones

In the beginning of this chapter, I mentioned that clones inherit their style from their originals. That is true: A clone of a red rectangle will be red. There are, however, several important exceptions and workarounds for this limitation.

First of all, opacity (8.1.2 Opacity) and blur (17.1 Blur) are not subject to this limitation at all: You can easily blur a clone or make it semitransparent. This is because these properties accumulate—that is, if you blur something and then blur its parent, these blurs add up, and the result will be more fuzzy than from either of these blurs taken alone. This also means that if your original is already blurred or has less than 100% opacity, you can make its clone more blurred or more transparent, but not less.

The same applies to filter effects (Chapter 17; actually, blur is just one of the filters). You can apply any filter to a clone, and it will work on top of any filters that the original of this clone has. For example, you can make the clone of a red rectangle green or gray by applying the Color Matrix filter primitive (8.8 Color Extensions and Filters).

But what about plain fill or stroke colors? Even they can be changed in a clone, but only if the original cooperates. Namely, any style property that you want to change in a clone must be unset in the original. Unsetting (8.1.1 Paint) is not the same as setting to none; a property is unset when it is simply not specified for an object, which allows its clone’s property to take effect instead.

A clone can be painted if its original has the paint unset.

Figure 16-5. A clone can be painted if its original has the paint unset.

Inkscape has a special button in the Fill and Stroke dialog, as well as a command in the selected style indicator (8.4 The Selected Style Indicator: Paint Commands), for unsetting the fill or stroke properties of an object. An object with an unset stroke simply has no visible stroke, but if you unset its fill, the object is shown as black. If you want to unset some other style property, you will need to use the XML Editor (4.7 The XML Editor) and manually edit the style attribute of the object, removing the property you want to override in the clones.

If you have a group as the original object, then you can unset fill or stroke in only some of the members of that group, leaving others colored. Then, if you clone that group and paint the clone, only the objects with unset properties will take on that color, whereas everything else will remain true to the original.