tikz: Draw rectangle with rounded corners only north/south?

One box and a path picture:

\documentclass[tikz,border=5]{standalone}
\tikzset{bicolor/.style args={#1 and #2}{
  path picture={
    \tikzset{rounded corners=0}
    \fill [#1] (path picture bounding box.west)
      rectangle (path picture bounding box.north east);
    \fill [#2] (path picture bounding box.west)
      rectangle (path picture bounding box.south east);
}}}
\begin{document}
\begin{tikzpicture}
\path [bicolor={blue and red}, rounded corners=2ex] 
  (0,0) rectangle (2,4);
\end{tikzpicture}
\end{document}  

enter image description here


Thank you for your suggestions! I liked the method proposed in the answer Torbjørn T. linked to the most, so I'm answering here myself.

Code:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{figure}[h]
\centering

\begin{tikzpicture}
\fill [blue,draw]
  (0,0) --
  ++(5,0) {[rounded corners=10] --
  ++(0,5) --
  ++(-5,0)} --
  cycle
  {};
\fill [red,draw]
  (0,0) --
  ++(5,0) {[rounded corners=10] --
  ++(0,-5) --
  ++(-5,0)} --
  cycle
  {};
\end{tikzpicture}

\end{figure}

\end{document}

Output:
enter image description here


\documentclass{article}

\usepackage[most]{tcolorbox}



\begin{document}




\begin{figure}[h]

\centering
\begingroup % for `\offinterlineskip` 
\offinterlineskip
\tcbset{arc=0.5cm,auto outer arc}
\begin{tcolorbox}[nobeforeafter,after=\par\nointerlineskip,sharp corners=south,height=4cm,colback=blue,boxrule=0pt,width=4cm]
\end{tcolorbox}
\begin{tcolorbox}[nobeforeafter,after=\par\nointerlineskip,sharp corners=north,height=4cm,colback=red,boxrule=0pt,width=4cm]
\end{tcolorbox}
\endgroup
\end{figure}

\end{document}

enter image description here