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

% Couleurs utilisées dans la documentation

\definecolor{codeTitleFont}{cmyk}{0.04,0,0.03,0.16}
\definecolor{codeTitleBackLeft}{rgb}{0.7,0.83,0.99}
\definecolor{codeTitleBackRight}{rgb}{0.86,0.91,0.97}
\definecolor{listingTitleFont}{rgb}{77,0.01,0.65}
\definecolor{listingTitleBackLeft}{cmyk}{0,0.05,0.64,0}
\definecolor{listingTitleBackRight}{cmyk}{0,0.03,0.31,0.02}
\definecolor{MainColor}{rgb}{0.06,0.44,0.61}
\definecolor{FrameColor}{rgb}{0.8,0.89,0.93}

\lstset{
	literate=
	{á}{{\'a}}1 {é}{{\'e}}1 {í}{{\'i}}1 {ó}{{\'o}}1 {ú}{{\'u}}1
	{Á}{{\'A}}1 {É}{{\'E}}1{Í}{{\'I}}1 {Ó}{{\'O}}1 {Ú}{{\'U}}1
	{à}{{\`a}}1 {è}{{\`e}}1 {ì}{{\`i}}1 {ò}{{\`o}}1{ù}{{\`u}}1
	{À}{{\`A}}1 {È}{{\'E}}1 {Ì}{{\`I}}1 {Ò}{{\`O}}1 {Ù}{{\`U}}1
	{ä}{{\"a}}1 {ë}{{\"e}}1 {ï}{{\"i}}1 {ö}{{\"o}}1 {ü}{{\"u}}1
	{Ä}{{\"A}}1 {Ë}{{\"E}}1 {Ï}{{\"I}}1 {Ö}{{\"O}}1 {Ü}{{\"U}}1
	{â}{{\^a}}1 {ê}{{\^e}}1 {î}{{\^i}}1 {ô}{{\^o}}1 {û}{{\^u}}1
	{Â}{{\^A}}1 {Ê}{{\^E}}1 {Î}{{\^I}}1 {Ô}{{\^O}}1 {Û}{{\^U}}1
	{œ}{{\oe}}1 {Œ}{{\OE}}1 {æ}{{\ae}}1 {Æ}{{\AE}}1 {ß}{{\ss}}1
	{ű}{{\H{u}}}1 {Ű}{{\H{U}}}1 {ő}{{\H{o}}}1 {Ő}{{\H{O}}}1
	{ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o}}1 {å}{{\r a}}1 {Å}{{\r A}}1
	{€}{{\EUR}}1 {£}{{\pounds}}1
}


% 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{10}{12}\selectfont,
		keywordstyle=\color{blue},
		numbers=left,
		language=TeX,
		breaklines=true,
		morekeywords={definecolor,tcbset,begin, newtcbtheorem,newenvironment,newcommand,bfseries,color, sffamily,tcblower,ttfamily,setlength,tabcolwidth,tabnumlinewidth, tablineheight,celtxt,selecCell,gentableur,plagecouleur,plagebordures,lignetxt,bfseries,usefont,helvbx, textbackslash},
		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{10}{12}\selectfont,
		keywordstyle=\color{listingTitleFont},
		numbers=left,
		language=TeX,
		breaklines=true,
		numbersep=5pt,
		morekeywords={ifelse,begin,definecolor,tcbset,tableur,draw, celtxt,multiSelec,renumLine,renumLineSelect,plagecouleur, plagebordures,gentableur,storewidthtolength, lignetxt,bfseries,sffamily,multimultiSelec, node, Large},
		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{MainColor}Sommaire},
	fonttitle=\bfseries\Large,
  	colback=FrameColor,
  	colframe=MainColor,
  	before=\par\bigskip\noindent,
  	interior style={
  		fill=FrameColor
%  		fill overzoom image=goldshade.png,
%  		fill image opacity=0.25
  	},
  	colbacktitle=FrameColor,
  	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
	}
}