This Will Make You a Sketch Layer Merging Pro

Leon Ephraïm
Design + Sketch
Published in
9 min readJul 26, 2017

Never understand what the heck is going on with merged layers? This article is for you!

Todays industry standard for icons export file types is of course SVG (or transparent PNG). Although the main incentive to use SVG’s are probably the scalability, the file size and the freedom of editing SVG are also awesome because of their transparency options. That means we, (icon) designers, have the opportunity/obligation to create icons that look good on various background colors.

This means our icons ought to contain layers that make up the icon and don’t contain any quick fix simulated negative spaces. In this tutorial we’ll lower the complexity of the icon as a shape (and final exported SVG) and make sure any negative space is an actual negative space (cut-out) and not a simulated one (a shape that has the background color overlaying an element, thus making it dependent of the background color). All in Sketch.

Creating an icon with shapes or layer styles to create negative space gets you nowhere when the icon is displayed on a difference background.

A couple of the things we’ll learn:

  • Turning overlaying shapes that mimic negative into actual cutouts
  • Merging multiple shaped layers into one single combined shaped layer
  • Changing with different Combine types (Union/Subtract)
  • Rearranging sublayer order

For this tutorial we’ll be working with a fairly simple mixer/settings icon that consists of three rounded rectangles and three oval shapes. The oval shapes all have both an inner stroke as well as an outer stroke. Go ahead and recreate the icon and group it’s layer in a layer group named Icon, or download the Sketch file.

We’ll work with a fairly simple icon to be able to make it easier to follow of every step we take.
The icon is made up of six layers.

Step 1. Convert any stroke containing layer to outlines

The first thing we’ll do is convert the Oval layers, that have multiple strokes mimicking the cutout effect, to outlines. We do so by selecting the layers and choosing Layer > Convert to Outline from the menu bar (or using keyboard combination ⇧⌘O).

Turning the layers with two strokes into fill layers the appearance of the icon will change and our layers will look like this ☝️

Step 2. Remove inside of outer stroke (cutout)

As the shapes had both a fill as well as two strokes, converting them to outlines has turned each Oval layer into two separate (combined shape) layers. That’s because an outline stroke is a combined path that exists of two shapes. One that determines the outer boundaries, whereas the the other determines the inner boundaries, creating the appearance of a stroke. In this case we don’t need the inner boundaries. We can get rid of the sublayer that is inside of the combined shape. Make sure you delete the right sublayer. It’s the bottom one within the combined shape layer. This is because Sketch automatically uses this sublayer order for strokes turned to outlines.

Converting the slider knob shapes to outlines has caused the very outer stroke (the cutout) to be placed above the inner stroke (the actual slider knob). That means a larger oval with the fill color you used for the outer stroke earlier will overlay the layer that was generated from the inner stroke.

Once we have removed the inside of the outer stroke our icon may look a strange due to layer ordering.

Step 3. Merge slider and outer stroke into a single layer

Draggin the Oval layer onto the Rectangle layer.

What we’ll do now is take the layers that made up the outer stroke (the cutout) and merge it with the first rectangle by dragging the first cutout layer onto the topmost Rectangle (slider).

You can also select both the oval layer and the rectangle layer (slider) and choose the ‘Union’ Combine type, by choosing ‘Layer > Combine > Union’ from the menu bar (or using key combo ⌥⌘U). However, for the sake of truly understanding every single step in the process.

Note: If the two layers you’re merging both have different layer styles, the layer that’s positioned lower in your layer panel will act like the dominant style. This means the layer that’s higher up the list in your layer panel will loose it’s original layer styles and adopt the lower-laying layer it’s merged with.

After having merged the first Oval (cutout) and the Rectangle (the slider) your icon will look something like this ☝️

Step 4. Repeat previous step for all three sliders

Now that we’ve merged the first slider and the first cutout together we can repeat Step 3 for the second and third slider as well.

We’ve now merged the outer strokes (cutouts) with their respective slider the slider knob seems invisible. Don’t worry, that’s just because it has the same fill color as the slider.

Step 5. Subtracting the outer stroke from the slider

Sketch will use the Union combine type by default when you drag a layer on top of another layer. This means the dragged shape will be added to the destination shape as if it were an extention to that shape.

What we will do next can also be done in hindsight. This is because the layer order in the final, completely merged single-shaped icon, can be different from the layer order of the three seperate sliders. In other words; any sublayer order one creates for seperate elements could interfere with the order of total sublayer in the final single-shaped icon. For the sake of understanding sublayer ordering and Combine types, I will however do

What we need to do now is subtract it from the slider, as that was the reason we used an outer border in the first place. To turn the shape that’s set to Union into a cutout we need to change the Combine type to Subtract. There are three ways to do this:

  1. By choosing Layer > Combine > Subtract from the menu bar (or using keyboard combination ⌥⌘S)
  2. By clicking on the Subtract icon in Sketch’s tool bar (assuming you have the Combine icons available in your toolbar)
  3. By clicking on the small Combine-type icon on the right of the layer (in the layer panel), and selecting Subtract from the dropdown menu.
Clicking on the small combine-type icon on the right side of the layer name shows all five options.

Step 6. Repeat previous step for all three sliders

We can now repeat Step 5 for the two remaining sliders.

All three sliders now have the cutout subtracted from the rectangle slider shape.

Step 7. Add the inner stroke to the slider

The next step is to add the inner strokes (the actual slider knob) –we generated along with the outer stroke (the cutout) in step 1– to their respective slider. The best way in my opinion to really have full control over what happens upon merge is to drag the inner stroke onto the slider.

In case the destination combined shaped layer is collapsed, Sketch will automatically order the added layer and it’s sublayers on top of the list.

I do suggest expanding the sublayers of the slider. This way you’ll have full control as to where the sublayers are placed within the slider sublayer list.

Having the combined shape ‘Rectangle’ expanded will make it easy to see the sublayer order.

Step 8. Repeat the previous step for all three sliders

Now that we know how to add the inner stroke (slider knob) we can repeat this step for the second and third slider as well.

After having hadded the all slider knobs to their respective sliders the layers will look like this ☝️

Step 9. Merge the three full sliders together

Now we can move on to merging the three sliders into one single-shaped layer. There are two ways to do this.

Method 1
The easy way is to drag the first slider onto the second slider, and subsequently drag the third full slider onto that single-shaped layer (first and second slider combined). This will create the exact result you want without any further adjustments.

Method 2
Although we get exactly what we want by using method 1 there is another way to achieve the same result. Although it takes some more time I suggest doing it this way to learn about layer order and Combine types. We select the three merged-shaped layers and choose ‘Layer > Combine > Union’ from the menu bar (or using keyboard combination ⌥⌘U).

After merging the three full sliders into one single Combined Shape, your icon will look like this ☝️

You will notice how some of the subtractions that were there before have now disappeared. Let’s move on to Step 10 to fix this.

Another thing you may notice is how merging the layers using the ‘Union’ Combine type will disregard the sublayer’s layer names. This is one of the reasons I normally don’t name sublayers for icons that still need merging, except for when the icon is rather complex. In case of complex icons I’d like to be able to quickly see what sublayer represents what part of the icon, and where it needs to be in terms of sublayer order.

Step 10. Change the Combine type & re-arrange sublayer order

We just saw how merging three single-shaped layers into one using Combine > Union disregards quite a few actions we’ve done before. No worries, this can be fixed quite easily.

We can either re-arrange the order of sublayers and then change the Combine type, or we can do it the other way around. Again, for the sake of understanding what we’re exactly doing, let’s start by changing the Combine type where necessary.

  1. Start by finding out what sublayer represents what part of the icon so we can alter the Combine type where needed. Basically be re-doing Step 4 in a way. You’ll notice how the outer cutout (the one that used to be the outer stroke, remember?) is still set to Subtract. That’s a good thing as that means each cutout is actually subtracted from each slider sublayer underneath it. The first change we’ll make it setting the Combine type of the very top most small cutout (the inside of the slider knob) from Union to Subtract, as it will need to be subtracted from it’s larger sibling.
  2. The next step is changing the Combine type of that larger sibling I just mentioned from None to Union.
  3. Now we need to re-arrange the order of the sublayers. That’s because it works in conjunction with layer order. After all, if a sublayer is set to subtract and there isn’t any layer. I prefer using an order that mimicks the way the sublayers are stacked, yet grouped per slider.
Changing the Combine type doesn’t necessarily immediately show the result you want. That’s because it works in conjunction with layer order.

Step 10 (optional). Flatten layers

We now have one single combined shape layer. But we could go even further in trimming down the icon’s footprint. If you want the icon to not be editable because you, say, want to distribute it together with other icons as an icon set you can choose to flatten the combined shape layer some more. You can do so by selecting the icon and Layer > Combine > Flatten. choosing Peter Nowell did an great job explaining the limitations of flattening shapes in Sketch, and I very well recommend reading his article on this subject.

Yo Adrian, I did it!!</rocky voice>

We boxed our way through the steps and we got the title belt: An icon that has actual negative space, instead of overlaying shapes or layer stylesto simulate the negative space. You’ll notice the icon no longer depends on having one set background color. Yay!

Practice what you preach

We’ve been using these techniques for some time now on all our icon projects. For example our icon set for the mobile apps for the NOS have all been exported this way to ensure a perfectly versatile and scalable set.

Another project where we applied these tricks is for Tiqets. You can clearly see the details where we applied the magic mentioned above several times.

We hope you learned something from this post. If you have, give me a shoutout on Twitter.

--

--