# How to create a polyline in illustrator, with each edge a different color?

I have a sequence of thick segments of different colors, which overlap at the end points. It looks like this:

I would like it to look more like a single path, like so (note the change in the corners):

Is there a simple way to do this with illustrator? I can manually convert each segment to a rectangle, and then move their vertices to get that effect, but perhaps there is a more direct way?

• Hm. Never faced before with such task :) Not sure that AI allows to colorize different segments of one path. I can suggest to convert your stroke into shape, slice with knife tool and colorize separately. May 27, 2014 at 11:57
• Yeah, nice solution @llan May 27, 2014 at 18:09
• Thanks @llan. I assume you refer to using a gradient. However, I need the transition between colors to be exactly at the vertices, which is not simple to do with gradient. May 27, 2014 at 20:32

If it is a regular polygon, you can use Adobe Illustrator and the gradient as in the answer suggested by Ilan and set each pair of middle stops to be at the percentage defined by the division of 100% and the number of sides of the polygon.
In an hexagon, that will be 16.67%, 33.34%, 50%, 66.67% 83.34%. In trying to answer the question, I discovered that it works best if they are not in the exact same position so I gave a 0.01% difference to each middle stop, in this sequence:

• Color A first stop: 0%
• Color A second (middle) stop: 16.66%
• Color B first stop: 16.67%

And so on.

For the gradient to reproduce the angular bisector, you have to select "Apply gradient along stroke" (please correct this if needed because I'm translating from the Spanish version of AI).

You can use rounded line caps (windows/stroke/cap) to get continuous (however slightly rounded) junctions, which is fine when all sections have the same colour.

• Seems like you want to make a contribution, thank you. Please stay focused on the question to keep this forum from getting cluttered. You could improve your answer for example by showing what your idea would look like when you apply it to a colour example like the OP gave us. Making a colour example might give you new ideas towards a solution. If you find that your method does not even work for colour, then you might want to delete it. Dec 23, 2018 at 12:30