%!TEX pdflatex

\documentclass{article}
\usepackage{customenvs}
\usepackage{cabin}
\usepackage{geometry}

\newlength\stylejrtitleheight
\newlength\stylejrheighttextleft
\newlength\stylejrheighttextright
\newlength\stylejrwidthleftpart
\newlength\stylejrmargincenter
\newlength\stylejrwidthrightpart

\setlength\stylejrtitleheight{1.15cm}
\setlength\stylejrheighttextleft{0.3\stylejrtitleheight}
\setlength\stylejrheighttextright{0.3\stylejrtitleheight}
\setlength\stylejrwidthleftpart{3cm}
\setlength\stylejrmargincenter{0.5cm}
\setlength\stylejrwidthrightpart{\textwidth-\stylejrwidthleftpart-\stylejrmargincenter}

\defKV[jrtitle]{%
	main color=\colorlet{jrtitlemain}{#1},%
	alt color=\colorlet{jrtitlealt}{#1},%
	font=\def\jrtitlefont{#1},%
	left upper=\def\jrtitleleftupper{#1},%
	left lower=\def\jrtitleleftlower{#1},%
	height=\setlength\stylejrtitleheight{#1},%
	left part=\setlength\stylejrwidthleftpart{#1},%
	inner sep=\setlength\stylejrmargincenter{#1}
}

\setKVdefault[jrtitle]{%
	main color=blue!50!black,%
	alt color=yellow!75!orange,%
	font=\bfseries\sffamily,%
	left upper={},%
	left lower={},%
	height=1.15cm,
	left part=3cm,%
	inner sep=0.75cm
}

\NewDocumentCommand\bicolortitle{ O{} D<>{} m }{%
	\restoreKV[jrtitle]%
	\setKV[jrtitle]{#1}%
	\noindent\begin{tikzpicture}[line width=0.4mm,jrtitlemain,every node/.style={text depth=0pt,font=\jrtitlefont,inner sep=0pt},#2]
		\setlength\stylejrwidthrightpart{\textwidth-\stylejrwidthleftpart-\stylejrmargincenter}
		%right part
		\draw ([xshift=-0.25\stylejrwidthrightpart-1mm,yshift=-0.8mm]{\textwidth},{\stylejrtitleheight}) -| ([xshift=-1mm,yshift=-0.75\stylejrtitleheight]{\textwidth},{\stylejrtitleheight}) ;
		\draw ([xshift=-0.275\stylejrwidthrightpart-1mm]{\textwidth},{\stylejrtitleheight}) -| ([xshift=-0.8mm-1mm,yshift=-0.725\stylejrtitleheight]{\textwidth},{\stylejrtitleheight}) ;
		\draw ([xshift=0.25\stylejrwidthrightpart,yshift=0.8mm]{\stylejrwidthleftpart+\stylejrmargincenter},0) -| ([yshift=0.75\stylejrtitleheight]{\stylejrwidthleftpart+\stylejrmargincenter},0) ;
		\draw ([xshift=0.275\stylejrwidthrightpart]{\stylejrwidthleftpart+\stylejrmargincenter},0) -| ([xshift=0.8mm,yshift=0.725\stylejrtitleheight]{\stylejrwidthleftpart+\stylejrmargincenter},0) ;
		\filldraw[line width=0.1mm,line join=round] ([xshift=-0.9\stylejrwidthrightpart,yshift=-0.4mm]{\textwidth},{\stylejrtitleheight}) to[bend left=1] ([xshift=-0.4\stylejrwidthrightpart,yshift=-0.4mm]{\textwidth},{\stylejrtitleheight}) to[bend left=1] cycle ;
		\filldraw[line width=0.1mm,line join=round] ([xshift=0.9\stylejrwidthrightpart,yshift=0.4mm]{\stylejrwidthleftpart+\stylejrmargincenter},0) to[bend left=1] ([xshift=0.4\stylejrwidthrightpart,yshift=0.4mm]{\stylejrwidthleftpart+\stylejrmargincenter},0) to[bend left=1] cycle ;
		%left part upper
		\filldraw[jrtitlealt,line join=round] (0.2mm,{0.25\stylejrtitleheight}) -- ({0.1\stylejrwidthleftpart},{\stylejrtitleheight-0.1mm}) -- ({\stylejrwidthleftpart},{\stylejrtitleheight-0.1mm}) -- ({0.8\stylejrwidthleftpart},{0.3\stylejrtitleheight}) -- cycle ;
		\filldraw[jrtitlemain,line join=round] ({0.04\stylejrwidthleftpart},{0.55\stylejrtitleheight}) -- ({0.95\stylejrwidthleftpart},{0.425\stylejrtitleheight}) -- ({0.85\stylejrwidthleftpart},{0.05\stylejrtitleheight}) -- ({0.2\stylejrwidthleftpart},0) -- cycle ;
		%coordinates left part + nodes
		\coordinate (LEFTUPPERPART) at ({0.475\stylejrwidthleftpart},{0.8\stylejrtitleheight}) ;
		\coordinate (LEFTLOWERPART) at ({0.525\stylejrwidthleftpart},{0.275\stylejrtitleheight}) ;
		\ifthenelse{\equal{\jrtitleleftupper}{}}%
		{}%
		{%
			\node[jrtitlemain] at (LEFTUPPERPART) {\fittexttobox{\vphantom{(qM)}\jrtitleleftupper}{0.7\stylejrwidthleftpart}{0.35\stylejrtitleheight}};
		}%
		\ifthenelse{\equal{\jrtitleleftlower}{}}%
		{}%
		{%
			\node[white] at (LEFTLOWERPART) {\fittexttobox{\vphantom{(qM)}\jrtitleleftlower}{0.6\stylejrwidthleftpart}{0.35\stylejrtitleheight}};%
		}%
		%title part
		\coordinate (RIGHTPART) at ({\textwidth-0.5\stylejrwidthrightpart},{0.5\stylejrtitleheight}) ;
		\coordinate (RIGHTPARTUPPER) at ({\textwidth-0.5\stylejrwidthrightpart},{0.675\stylejrtitleheight}) ;
		\coordinate (RIGHTPARTLOWER) at ({\textwidth-0.5\stylejrwidthrightpart},{0.325\stylejrtitleheight}) ;
		\IfSubStr{#3}{§}%two lines
		{%
			\StrCut{#3}{§}{\jrtitleupper}{\jrtitlelower}%
			\node[] at (RIGHTPARTUPPER) {\fittexttobox{\vphantom{(qM)}\jrtitleupper}{0.9\stylejrwidthrightpart}{0.5\stylejrtitleheight-1.2mm}};%
			\node[] at (RIGHTPARTLOWER) {\fittexttobox{\vphantom{(qM)}\jrtitlelower}{0.9\stylejrwidthrightpart}{0.5\stylejrtitleheight-1.2mm}};%
		}%
		{%
			\node[] at (RIGHTPART) {\fittexttobox{\vphantom{(qM)}#3}{0.9\stylejrwidthrightpart}{\stylejrtitleheight-3.2mm}};%
		}%
		
	\end{tikzpicture}
}

\begin{document}

\bicolortitle[left upper=CH-01,left lower=Fiche 1]{TEST}

\medskip

\bicolortitle[left upper=CH-01,left lower=Fiche 1]{une semaine pour travailler§mes automatismes}

\medskip

\bicolortitle[main color=red,alt color=yellow,left upper=CH-01,left lower=Fiche 1,inner sep=1.5cm,left part=2cm,height=0.75cm]{une semaine pour travailler§mes automatismes}

\end{document}