6

I have this shape and I want to keep the left part black (exactly from the middle) while having the right part grey. Is this possible? If I don't join the lines, I don't get the sharp end that I want. If I do, I can't have two different colours.

enter image description here

  • problem is the answer is infinite in the effort to find the centre. you never can. – NRGBalance Sep 9 at 13:25
13

Apply a gradient to the path stroke from black to gray and set each color location to 50%.

enter image description here

5

The gradient solution of @Danielillo is cool and easy, but like @Luciano I don't trust the sharpness of a gradient. I would suggest to use clipping masks like this:

  1. Select the object by left-clicking it.
  2. Press Ctrl / Cmd + C to copy the object.
  3. Press Ctrl / Cmd + F to paste the object in the same position.
  4. Draw a transparent rectangle which covers one half of the object.
  5. Hold down Alt + Shift and drag a copy of the rectangle covers the other half of the object.
  6. Select one of the copies of the object and one of the rectangles, right click and select Make Clipping Mask.
  7. Select the other copy of the object and the other rectangle, right click and select Make Clipping Mask.

Now you have two objects, each contained in its own clipping mask. You are now able to give the two objects different appearances.

2

The gradient solution works wonderfully for this particular case, but what if you want to get more creative on the slicing of the colors?

There may be more elegant ways to achieve it, but using the paste in front/back option to duplicate the element, and masking it off with clipping paths will give you fare more control over how the colors overlap one another.

  • Good one. Maybe even make it a symbol before duplicating, in case there needs to be some update to the path (maybe not in this case, but with a more complex object it might come in handy). Also I don't trust much gradient steps sharpness, I'd rather have well-defined edges. – Luciano Sep 9 at 14:10

protected by DᴀʀᴛʜVᴀᴅᴇʀ Sep 9 at 23:38

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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