As a follow-up question of Use gradient or picture as fill in split rectangle? and with many thanks to Zarko's answer, I tried to modify their code to split the rectangle side by side.
The following code:
\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{backgrounds, fit, positioning, shapes.multipart}
\newcommand\ppbb{path picture bounding box}
\begin{document}
\begin{tikzpicture}[
box/.style args = {#1/#2}{
rectangle split, rectangle split horizontal, rectangle split parts=2,
rounded corners,
text width=3cm, align=center,
path picture={ \begin{scope}[on background layer]
\draw[thick, % node part one
left color=#1, right color=#1!20!white]
(\ppbb.south) [rounded corners] -| (\ppbb.west) |- (\ppbb.north) [sharp corners] -| (\ppbb.north |- \ppbb.east) -| cycle;
\draw[thick, % node part two
left color=#2, right color=#2!20!white]
(\ppbb.south) [rounded corners] -| (\ppbb.east) |- (\ppbb.north) [sharp corners] -| (\ppbb.south |- \ppbb.west) -| cycle;
\end{scope}
}%end of path picture
}
]
\node [box=blue/red]
{\nodepart{one} text \\ text \\ text \\ text
\nodepart{two} text \\ text \\ text \\ text};
\end{tikzpicture}
\end{document}
produces the following figure:
However, I do not know how to fix the upper part (I would like the upper part to be the same as the bottom part) as I do not understand this part of the code:
\draw[thick, % node part one
left color=#1, right color=#1!20!white]
(\ppbb.south) [rounded corners] -| (\ppbb.west) |- (\ppbb.north) [sharp corners] -| (\ppbb.north |- \ppbb.east) -| cycle;
\draw[thick, % node part two
left color=#2, right color=#2!20!white]
(\ppbb.south) [rounded corners] -| (\ppbb.east) |- (\ppbb.north) [sharp corners] -| (\ppbb.south |- \ppbb.west) -| cycle;
Could someone please explain?