Skip to main content
The 2024 Developer Survey results are live! See the results
added 32 characters in body
Source Link
hpekristiansen
  • 38.4k
  • 9
  • 62
  • 117
\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[
ultra thick,
left/.tip={Rectangle[sep=0ptButt Cap[sep=0pt -1]Rectangle[sep=0pt -0.5, slant=-1 ,width=0pt 1, length=0pt 2]},
right/.tip={Rectangle[sep=0ptButt Cap[sep=0pt -1]Rectangle[sep=0pt -0.5, slant=1 ,width=0pt 1, length=0pt 2]},
]
\draw[line\draw[green, cap=rect]-right] 
 (0,0.5) edge[green, -right]- (0,1);
(0,1) edge[blue\draw[blue, left-right] (10,1)
  -- (1,1) edge[yellow;
\draw[yellow, left-right] (1,01)
  -- (1,0) edge[red;
\draw[red, left-] (1,0) -- (0.5,0);
\end{tikzpicture}
\end{document}

Multi colored square

\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[
ultra thick,
left/.tip={Rectangle[sep=0pt -0.5, slant=-1 ,width=0pt 1, length=0pt 2]},
right/.tip={Rectangle[sep=0pt -0.5, slant=1 ,width=0pt 1, length=0pt 2]},
]
\draw[line cap=rect] 
 (0,0.5) edge[green, -right] (0,1)
(0,1) edge[blue, left-right] (1,1)
 (1,1) edge[yellow, left-right] (1,0)
 (1,0) edge[red, left-] (0.5,0);
\end{tikzpicture}
\end{document}

Multi colored square

\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[
ultra thick,
left/.tip={Butt Cap[sep=0pt -1]Rectangle[sep=0pt -0.5, slant=-1 ,width=0pt 1, length=0pt 2]},
right/.tip={Butt Cap[sep=0pt -1]Rectangle[sep=0pt -0.5, slant=1 ,width=0pt 1, length=0pt 2]},
]
\draw[green, -right] (0,0.5) -- (0,1);
\draw[blue, left-right] (0,1) -- (1,1);
\draw[yellow, left-right] (1,1) -- (1,0);
\draw[red, left-] (1,0) -- (0.5,0);
\end{tikzpicture}
\end{document}

Multi colored square

Source Link
hpekristiansen
  • 38.4k
  • 9
  • 62
  • 117

\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}[
ultra thick,
left/.tip={Rectangle[sep=0pt -0.5, slant=-1 ,width=0pt 1, length=0pt 2]},
right/.tip={Rectangle[sep=0pt -0.5, slant=1 ,width=0pt 1, length=0pt 2]},
]
\draw[line cap=rect] 
(0,0.5) edge[green, -right] (0,1)
(0,1) edge[blue, left-right] (1,1)
(1,1) edge[yellow, left-right] (1,0)
(1,0) edge[red, left-] (0.5,0);
\end{tikzpicture}
\end{document}

Multi colored square