2

Drawing inspiration from the question TikZ: Get values for predefined dash patterns, I would like to draw a node using a dash pattern that uses multiple color. The pgfmanual entry on dash pattern states that the syntax for specifying dash patterns is the same as in METAFONT, which I'm not familiar with. I quickly browsed at the Metafun manual (recommended at https://tex.meta.stackexchange.com/a/3427/5471), but I'm still not sure what to do.

Abdallah
  • 533

1 Answers1

5

I'm not sure if it's possible to define a dash pattern with more than one color, but you could try something like this:

\documentclass[border=2mm,tikz]{standalone}

\tikzset{
    dashone/.style={dash pattern=on 3pt off 5pt},
}

\begin{document}
\begin{tikzpicture}
\node[minimum size=3cm, draw, dashone, red, postaction={draw=blue, dash phase=4pt}] {};
\end{tikzpicture}
\end{document}

enter image description here

muzimuzhi Z
  • 26,474
Ignasi
  • 136,588