I want to have a node with different border colors: One for the upper and left border, one for the lower and right color.
Is this possible? From all examples I found, it seems that I can only set the color as a whole, not for each side.
I want to have a node with different border colors: One for the upper and left border, one for the lower and right color.
Is this possible? From all examples I found, it seems that I can only set the color as a whole, not for each side.
This should get you started. More polishing can be done, but left as an exercise.
\documentclass{article}
\usepackage{tikz}
\tikzset{%
pics/.cd,
mynode/.style args={#1#2#3}{
code={\node (a) {#3};
\draw[thick,#1] (a.south west) |- (a.north east);
\draw[thick,#2] (a.south west) -| (a.north east);
}
},
}
\begin{document}
\begin{tikzpicture}
\pic {mynode={red}{blue}{Here}};
\pic at (4,0) {mynode={olive}{magenta}{Here comes another one}};
\end{tikzpicture}
\end{document}

\documentclass{article}
\usepackage{tikz}
\tikzset{%
pics/.cd,
mynode/.style args={#1#2#3}{
code={\node (a) {#3};
\draw[thick,#1,line cap=butt,shorten <= -0.5\pgflinewidth,shorten >= 0.5\pgflinewidth] (a.south west) |- (a.north east);
\draw[thick,#2,line cap=butt,shorten <= 0.5\pgflinewidth,shorten >= -0.5\pgflinewidth] (a.south west) -| (a.north east);
}
},
}
\begin{document}
\begin{tikzpicture}
\pic {mynode={red}{blue}{Here}};
\pic at (4,0) {mynode={olive}{magenta}{Here comes another one}};
\end{tikzpicture}
\end{document}

0.5, but the gap has a different width depending on the zoom level, so this is not the solution. I need a way to actually connect the lines with each other.
– flyx
Sep 09 '14 at 18:44
fitpackage, but I guess I would get problems with deeper nesting when I do this. – flyx Sep 07 '14 at 12:32Page not found– alper Jul 22 '22 at 15:07