\tcbuselibrary{listings}
\usetikzlibrary{decorations.pathmorphing}

% Couleurs utilisées dans la documentation

\definecolor{codeTitleFont}{cmyk}{0.04,0,0.03,0.16}
\definecolor{codeTitleBackLeft}{cmyk}{0.08,0,0.06,0.76}
\definecolor{codeTitleBackRight}{cmyk}{0.07,0,0.05,0.42}
\definecolor{listingTitleFont}{cmyk}{0,0.31,0.91,0.38}
\definecolor{listingTitleBackLeft}{cmyk}{0,0.05,0.64,0}
\definecolor{listingTitleBackRight}{cmyk}{0,0.03,0.31,0.02}


% Code LaTeX

\tcbset{codeTEX/.style={
	sharp corners=all,
	before skip=1em,
	after skip=1em,
	enhanced,
	frame style={	
			left color=codeTitleBackLeft,
			right color=codeTitleBackRight},
	interior style={
		top color=codeTitleBackLeft!50,
		bottom color=codeTitleBackRight!20},
	boxrule=0.7pt,
	fonttitle={\sffamily\bfseries\color{codeTitleFont}},
	colback=codeTitleFont,
	listing only,
	left=6mm,
	listing options={
		basicstyle=\ttfamily\fontsize{7}{9}\selectfont,
		keywordstyle=\color{blue},
		numbers=left,
		language=TeX,
		breaklines=true,
		morekeywords={definecolor,tcbset,begin, newtcbtheorem,newenvironment,newcommand,bfseries,color, sffamily,tcblower,ttfamily,setlength},
		numberstyle=\tiny\color{red!75!black}},
	breakable
	}
}

% Listing exemples

\tcbset{listing/.style={
	sharp corners=all,
	before skip=1em,
	after skip=1em,
	enhanced,
	frame style={	
			left color=listingTitleBackLeft,
			right color=listingTitleBackRight},
	boxrule=0.7pt,
	fonttitle={\sffamily\bfseries\color{listingTitleFont}},
	colback=listingTitleBackRight,
	breakable,
	listing options={
		basicstyle=\ttfamily\fontsize{7}{9}\selectfont,
		keywordstyle=\color{listingTitleFont},
		numbers=left,
		language=TeX,
		breaklines=true,
		numbersep=5pt,
		morekeywords={ifelse,begin,definecolor,tcbset},
		numberstyle=\tiny\color{red!75!black}},
	},
	interior style={
		draw=listingTitleBackLeft,
		top color=listingTitleBackLeft!50,
		bottom color=listingTitleBackRight!20},
	  segmentation style={
		draw=listingTitleFont,
		solid,
		decorate,
		decoration={random steps,segment length=2mm}
	}
}

% Titre de la documentation

\tcbset{head/.style={
	enhanced,
	hbox,
	tikznode,
	left=8mm,
	right=8mm,
	boxrule=0.4pt,
  colback=white,
  colframe=gray,
  drop lifted shadow=black!50!yellow,
  before=\par\vspace*{5mm},
  after=\par\bigskip,
  interior style={
		draw=white,
		top color=white,
		bottom color=white}
	}
}

% TOC

\tcbset{toc/.style={
	breakable,
	enhanced jigsaw,
	title={\color{red!50!black}Sommaire},
	fonttitle=\bfseries\Large,
  colback=yellow!10!white,
  colframe=red!50!black,
  before=\par\bigskip\noindent,
  interior style={
  	fill overzoom image=goldshade.png,
  	fill image opacity=0.25},
  colbacktitle=yellow!20,
  enlargepage flexible=\baselineskip,
  pad at break*=3mm,
  attach boxed title to top center={
  	yshift=-0.25mm-\tcboxedtitleheight/2,
  	yshifttext=2mm-\tcboxedtitleheight/2},
  boxed title style={
  	enhanced,
  	boxrule=0.5mm,
    frame code={ 
    \path[tcb fill frame] ([xshift=-4mm]frame.west) -- (frame.north west)
    -- (frame.north east) -- ([xshift=4mm]frame.east)
    -- (frame.south east) -- (frame.south west) -- cycle; },
    interior code={ 
    	\path[tcb fill interior] ([xshift=-2mm]interior.west)
    -- (interior.north west) -- (interior.north east)
    -- ([xshift=2mm]interior.east) -- (interior.south east) -- (interior.south west)
    -- cycle;}  },
  drop fuzzy shadow
	}
}

% Historique de l'extension

\tcbset{histo/.style={
	enhanced,
	breakable,
	sidebyside,
	lefthand width=1.5cm
	}
}