Skip to main content
Known Participant
October 8, 2021
Question

How to create a dashed line with alternating colors and gaps in between

  • October 8, 2021
  • 3 replies
  • 4315 views

I'm trying to create a dashed line triangle with alternating colored dashes and white spaces between. How do I do that? 

 

I've tried expanding the appearance and then seleting one dash to recolor it, but then it recolors the whole line. I've also tried ungrouping that line and it still recolors the whole line. I want the segments separate so that I can color them without it changing the whole line. 

This topic has been closed for replies.

3 replies

tromboniator
Community Expert
October 8, 2021

Create a path with three strokes: top stroke whitewith desired dash length and same gap length: middle stroke with first color, dash length and gap 2× top stroke values; bottom stroke second color, no dash. Save as Graphic Style.

 

Be sure dashes have this setting:

Peter

 

Edit: You might want to increase the stroke weight of the white gaps a bit (1 pt?) so that there's no hint of the underlying color at the edge.

 

In addition, if you want the white gaps to be invisible, in the Appearance panel set the opacity to 0%, then in the Opacity settings for the entire path click on the checkbox for Knockout Group, either once or twice until the ✓ appears. If it's a dash - , click again. This will make not only the white dashes disappear, but also the underlying second color.

 

 

Met1
Brainiac
October 8, 2021

Use the appearance panel and add a second or more paths, you can change the stacking just by dragging, play with the gap size to change the overlaps...

michelew83603738
Community Expert
October 8, 2021

Nice!

Monika Gause
Community Expert
October 8, 2021

Make a pattern brush