I would like to fill in one of the three portions of this shape. Note that the outer 4 corners are rounded. enter image description here

  • Why not make your background rectangle into 3 rectangles and fill one? Or place a new rectangle on top of the one you want to fill? – Ashlee Palka Jun 7 '17 at 16:42
  • I thought about that. I want rounded edges (like in the screenshot). Can you show me how to make a rectangle where only 2 of the edges are rounded? I tried placing a new rect on top of the one I want to fill, but it doesn't fill nicely with the rounded edges. It's very clunky, and looks terrible. – jungledev Jun 7 '17 at 16:47

The solution to this is not to try and fill only part of the shape, but to make the shapes three separate objects that can then be filled with whatever colour you want. So in your case, you would want a standard rectangle in the middle, with rectangles on either side that each have two right angle corners and two rounded corners.

I found this with a little bit of hunting... http://www.sketchtips.info/articles/rounded-corners

Turns out that you can have rectangles with different radii on each corner, but the way that you do that is a bit hidden in Sketch. You need to replace the single number in the radius box with four numbers separated by semicolons (;) the order of the numbers gives the radius of the corners as follows: top left, top right, bottom right, bottom left. i.e. clockwise from top left.

So for your case, assuming that you have a corner radius of 5, the corners for the leftmost shape would be 5;0;0;5 and for the shape on the right the corner radius box would need to contain 0;5;5;0.

Pretty tidy and easy when you know how, but not very discoverable.

| improve this answer | |

I agree with Westside that chopping up your shape would be the best idea.

If you'd really want to colour your single shape only partially, you could use a gradient fill with stops very close to each other on the exact place of the separator. So, say that the separators are at 40% and 75% of the shape's width, you'd make grey stops at 0%, 40%, 75% and 100% and your desired colour's stops at 40.1% and 74.9%. That would colour the middle part of the shape.

If you place stops this close together, the gradient no longer functions as a gradient, because the colour transition is almost immediate.

| improve this answer | |
  • Thank you! This is a very creative way to do this. I was wondering if it could work like this, and I appreciate the detailed example! – jungledev Jun 8 '17 at 16:38

I proceeded as follow :

  1. Creating a bordered/unfilled star

enter image description here

enter image description here

  1. Creating (manually) a vector half the size of the star, filled with the good color

enter image description here enter image description here

  1. Place the vector behind the star

enter image description here


| improve this answer | |
  • 1
    Welcome to GD.SE. 1. why a star? Nothing in the question mentions creating a star. 2. this question was answered already a long time ago, yours doesn't add anything new. Take a tour to learn how the site works and how you can contribute! – Luciano Aug 14 '18 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.