% Author..........: C. Pierquet
% licence.........: Released under the LaTeX Project Public License v1.3c or later, see http://www.latex-project.org/lppl.txt

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{customenvs-tikzpictos}[2025/08/30 0.1.7 Small pictograms, made with tikz]

%====HISTORY
% v 0.1.7	Rings + Rubik's Cube
% v 0.1.6	Bugfix with pictostars (raisebox...)
% v 0.1.5	Inline badge (inspired by tikz-shields) + small stamp
% v 0.1.4	Strut option for sample characters + difficultylevels + dballs + stamp
% v 0.1.3	Clippy
% v 0.1.2	Mini-calendar
% v 0.1.1	PictoTraffic
% v 0.1.0	Initial version subpackage of customenvs

%====PACKAGES
\RequirePackage{xintexpr}
\RequirePackage{simplekv}
\RequirePackage{xstring}
\RequirePackage{listofitems}
\RequirePackage{ifthen}
\RequirePackage{calc}
\RequirePackage{tikz}
\usetikzlibrary{shapes.geometric,bbox,calc}
\RequirePackage{tcolorbox}
\tcbuselibrary{skins}

%====strutletters
\def\samplestrutletters{AZERTYUIOPSDFGHKLMWXCVBN}
\def\samplestrutletters{AZERTYUIOPSDFGHKLMWXCVBN}
\def\sampledstrutletters{azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN}

%====pictostars
\newlength{\pictotmphauteuretoiles}
\newlength{\pictotmpprofondeuretoiles}
\newlength{\pictotmpoffsetetoiles}
\setlength{\pictotmpoffsetetoiles}{0.25pt}

\defKV[pictostars]{%
	colors=\def\tkzLevelStarsColors{#1},%
	offset=\setlength{\pictotmpoffsetetoiles}{#1},%
	height=\def\pictotmpheightetetoiles{#1},%
	strut=\def\pictotmpstrutetetoiles{#1},%
	dstrut=\def\pictotmpdstrutetetoiles{#1}
}

\setKVdefault[pictostars]{%
	colors={black/lightgray},%
	offset={0.01em},%
	height=dauto,%
	strut={\samplestrutletters},%
	dstrut={\sampledstrutletters}
}

\newcommand\intpictostars{%
	\foreach \X in {1,...,\tkzLevelStarsMaxLevel}{%
		\xdef\tmpxfill{\xintfloateval{min(1,max(1+(\pictotmpnbetoiles)-\X,0))}}%
		\path ({\X*(\pictotmphauteuretoiles+\pictotmpoffsetetoiles)},0) node[star,draw,star point height={0.25\pictotmphauteuretoiles},minimum size={\pictotmphauteuretoiles},inner sep=0pt,path picture={\fill (path picture bounding box.south west) rectangle  ([xshift=\tmpxfill*0.9515*\pictotmphauteuretoiles]path picture bounding box.north west);}]{};
	}%
}

\NewDocumentCommand{\pictostars}{O{}D<>{}m}{%(OK) modif avec hauteur
	%#1=clés
	%#2=options tikz
	%#3=données nb/nblev
	\restoreKV[pictostars]%
	\setKV[pictostars]{#1}%
	%lecture des données
	\IfSubStr{#3}{/}%
		{%
			\StrCut{#3}{/}{\pictotmpnbetoiles}{\tkzLevelStarsMaxLevel}%param complet
		}%
		{%
			\IfStrEq{#3}{}%
				{\def\pictotmpnbetoiles{0}\def\tkzLevelStarsMaxLevel{3}}%si vide 0/3
				{\def\pictotmpnbetoiles{#3}\def\tkzLevelStarsMaxLevel{3}}%sinon #3/3
		}%
	%couleurs
	\IfSubStr{\tkzLevelStarsColors}{/}%
		{%
			\StrCut{\tkzLevelStarsColors}{/}{\tkzLevelStarsColor}{\tkzLevelStarsColorBg}%
		}%
		{%
			\def\tkzLevelStarsColor{\tkzLevelStarsColors}\def\tkzLevelStarsColorBg{\tkzLevelStarsColors}%
		}%
	%lengths
	\IfSubStr{\pictotmpheightetetoiles}{auto}%
		{%
			\IfStrEq{\pictotmpheightetetoiles}{auto}%
				{%
					\settototalheight{\pictotmphauteuretoiles}{\hbox{\pictotmpstrutetetoiles}}%
					\setlength{\pictotmphauteuretoiles}{0.975\pictotmphauteuretoiles}%
					%classic tikzpicture
					\begin{tikzpicture}[bezier bounding box,fill=\tkzLevelStarsColorBg,draw=\tkzLevelStarsColor,rounded corners={0.05\pictotmphauteuretoiles},line width={0.05\pictotmphauteuretoiles},#2]
						\intpictostars
					\end{tikzpicture}%
				}{}%
			\IfStrEq{\pictotmpheightetetoiles}{dauto}%
				{%
					\settototalheight{\pictotmphauteuretoiles}{\hbox{\pictotmpdstrutetetoiles}}%
					\setlength{\pictotmphauteuretoiles}{0.975\pictotmphauteuretoiles}%
					\settodepth{\pictotmpprofondeuretoiles}{\hbox{\pictotmpdstrutetetoiles}}%
					%raised tikzpicture
					%\begin{tikzpicture}[bezier bounding box,baseline={-1.25\pictotmpprofondeuretoiles},fill=\tkzLevelStarsColorBg,draw=\tkzLevelStarsColor,rounded corners={0.05\pictotmphauteuretoiles},line width={0.05\pictotmphauteuretoiles},#2]
					\raisebox{\dimexpr-\pictotmpprofondeuretoiles+0.025\pictotmphauteuretoiles\relax}{%
						\begin{tikzpicture}[bezier bounding box,fill=\tkzLevelStarsColorBg,draw=\tkzLevelStarsColor,rounded corners={0.05\pictotmphauteuretoiles},line width={0.05\pictotmphauteuretoiles},#2]
							\intpictostars
						\end{tikzpicture}%
					}%
				}%
				{}%
		}%
		{%
			\setlength\pictotmphauteuretoiles{\pictotmpheightetetoiles}%
			%classic tikzpicture
			\begin{tikzpicture}[bezier bounding box,fill=\tkzLevelStarsColorBg,draw=\tkzLevelStarsColor,rounded corners={0.05\pictotmphauteuretoiles},line width={0.05\pictotmphauteuretoiles},#2]
				\intpictostars
			\end{tikzpicture}%
		}%
}

%====PICTO SPEEDO
\newlength{\pictotmphauteurgradniv}

\defKV[pictoskillswheel]{%
	colors=\def\miniskillswheelcol{#1},%
	height=\def\miniskillswheelheight{#1},%
	strut=\def\miniskillswheelstrut{#1},%
	dstrut=\def\miniskillswheeldstrut{#1}
}
\setKVdefault[pictoskillswheel]{%
	colors=black,%
	height=dauto,%
	strut=\samplestrutletters,%
	dstrut=\sampledstrutletters
}

\NewDocumentCommand\pictospeedometer{O{}D<>{}m}{%(OK) à voir avec hauteur auto...
	%#1 = clés
	%#2 = options tikz
	%#2 = données nb/nblev
	\restoreKV[pictoskillswheel]%
	\setKV[pictoskillswheel]{#1}%
	%height
	\IfSubStr{\miniskillswheelheight}{auto}%
		{%
			\IfStrEq{\miniskillswheelheight}{auto}%
				{%
					\settototalheight{\pictotmphauteurgradniv}{\hbox{\miniskillswheelstrut}}%
					\setlength{\pictotmphauteurgradniv}{0.95\pictotmphauteurgradniv}%
				}{}%
			\IfStrEq{\miniskillswheelheight}{dauto}%
				{%
					\settototalheight{\pictotmphauteurgradniv}{\hbox{\miniskillswheeldstrut}}%
					\setlength{\pictotmphauteurgradniv}{0.95\pictotmphauteurgradniv}%
				}{}%
		}%
		{%
			\setlength\pictotmphauteurgradniv{\miniskillswheelheight}%
		}%
	%data
	\IfStrEq{#3}{}%lecture des données
		{\def\miniskillswheelmark{}\def\pictospeednb{6}}%
		{%
			\IfSubStr{#3}{/}%
				{\StrCut{#3}{/}{\miniskillswheelmark}{\pictospeednb}}%
				{\def\miniskillswheelmark{#3}\def\pictospeednb{6}}%
		}%
	\IfEq{\miniskillswheelmark}{}%
		{}%
		{%
			\xintifboolexpr{\miniskillswheelmark >= 0 'and' \miniskillswheelmark <= \pictospeednb}%
				{%
					\xdef\miniskilswheelposcurs{\xintfloateval{180-180*(\miniskillswheelmark)/(\pictospeednb)}}%
				}%
				{%
					\xdef\miniskilswheelposcurs{\xintfloateval{0.5*(\pictospeednb)}}%
				}%
		}%
	\IfSubStr{\miniskillswheelcol}{/}%
		{%
			\StrCut{\miniskillswheelcol}{/}{\miniskillswheelcolp}{\miniskillswheelcols}%
		}%
		{%
			\xdef\miniskillswheelcolp{\miniskillswheelcol}\xdef\miniskillswheelcols{\miniskillswheelcol}%
		}%
	\IfSubStr{\miniskillswheelheight}{auto}%
		{%
			\IfStrEq{\miniskillswheelheight}{auto}%
				{%
					%classic tikzpicture
					\begin{tikzpicture}[bezier bounding box,line width={0.066\pictotmphauteurgradniv},#2,transform shape]
				}{}%
			\IfStrEq{\miniskillswheelheight}{dauto}%
				{%
					%raised tikzpicture
					\begin{tikzpicture}[bezier bounding box,baseline={-0.01\pictotmphauteurgradniv},line width={0.066\pictotmphauteurgradniv},#2,transform shape]
				}{}%
		}%
		{%
			%classic tikzpicture
			\begin{tikzpicture}[bezier bounding box,line width={0.066\pictotmphauteurgradniv},#2,transform shape]
		}%
		\draw[\miniskillswheelcolp] (-15:{0.7588\pictotmphauteurgradniv}) arc(-15:195:{0.7588\pictotmphauteurgradniv}) --cycle ;
		\foreach \i in {0,...,\pictospeednb}{%
			\draw[\miniskillswheelcolp,line cap=round] ({180-180*(\i)/\pictospeednb}:{0.55\pictotmphauteurgradniv})--({180-180*(\i)/\pictospeednb}:{0.65\pictotmphauteurgradniv}) ;
		}%
		\IfEq{\miniskillswheelmark}{}%
			{}%
			{%
				\draw[\miniskillswheelcols] (0,0) circle[radius=0.1\pictotmphauteurgradniv] ;
				\draw[\miniskillswheelcols,line cap=round] ({\miniskilswheelposcurs}:{0.1\pictotmphauteurgradniv}) -- ({\miniskilswheelposcurs}:{0.6125\pictotmphauteurgradniv}) ;
			}%
	\end{tikzpicture}%
}

%====PICTO BULLSEYE
\defKV[tkzArrowBullsEye]{%
	height=\def\heightarrowbullseye{#1},%
	maincolor=\def\colorarrowbullseye{#1},%
	listcolors=\def\colorslistarrowbullseye{#1},%
	strut=\def\strutarrowbullseye{#1},%
	dstrut=\def\dstrutarrowbullseye{#1}
}
\setKVdefault[tkzArrowBullsEye]{%
	height=dauto,%
	maincolor={},%
	color=false,%
	colors=false,%
	listcolors={yellow,red,blue!50!cyan},%
	strut=\samplestrutletters,%
	dstrut=\sampledstrutletters
}

\newcommand\inttkzArrowBullsEye{
	\draw (54:2.25) arc (54:396:2.25) (0,0) circle[radius=0.6] (0,0) circle[radius=1.36] ;
	\draw[line cap=round,line join=round] (0,0)--(45:1.7) -- (55:2.5) -- (52:3.5) -- (45:3.1) -- (38:3.5) -- (35:2.5) -- (45:1.7) -- cycle;
}

\newcommand\intcolortkzArrowBullsEye{
	\filldraw[black,fill=\colbullseyeC] (0,0) circle[radius=2.25] ;%
	\filldraw[black,fill=\colbullseyeB] (0,0) circle[radius=1.36] ;
	\filldraw[black,fill=\colbullseyeA] (0,0) circle[radius=0.6] ;
	\draw[black,fill=white,line cap=round,line join=round] (0,0)--(45:1.7) -- (55:2.5) -- (52:3.5) -- (45:3.1) -- (38:3.5) -- (35:2.5) -- (45:1.7) -- cycle;
}

\newlength\totheightarrowbullseye
\newlength\depthbullseye

\NewDocumentCommand\pictobullseye{O{}D<>{}}{%(OK)
	%#1 = keys
	%#2 = tikz options
	\restoreKV[tkzArrowBullsEye]%
	\setKV[tkzArrowBullsEye]{#1}%
	\ifboolKV[tkzArrowBullsEye]{colors}%
		{\setKV[tkzArrowBullsEye]{color=true}}%
		{}%
	\ifboolKV[tkzArrowBullsEye]{color}%
		{%
			\setsepchar{,}\readlist\lstcolorslistarrowbullseye{\colorslistarrowbullseye}%
			\itemtomacro\lstcolorslistarrowbullseye[1]\colbullseyeA%
			\itemtomacro\lstcolorslistarrowbullseye[2]\colbullseyeB%
			\itemtomacro\lstcolorslistarrowbullseye[3]\colbullseyeC%
		}%
		{}%
	%scale
	\IfSubStr{\heightarrowbullseye}{auto}%
		{%
			\IfStrEq{\heightarrowbullseye}{dauto}%
				{%dauto with depth
					\settototalheight\totheightarrowbullseye{\hbox{\dstrutarrowbullseye}}%
					\settodepth\depthbullseye{\hbox{\dstrutarrowbullseye}}%
				}%
				{%auto without depth
					\settototalheight\totheightarrowbullseye{\hbox{\strutarrowbullseye}}%
				}%
		}%
		{%
			\setlength\totheightarrowbullseye{\heightarrowbullseye}%
		}%
	%scale + style
	\pgfmathsetmacro{\tikzarrowbullseyescale}{\totheightarrowbullseye/53mm}%
	\tikzset{tkzarrowbullseye/.style={scale=\tikzarrowbullseyescale,line width=\fpeval{2.75*\tikzarrowbullseyescale}mm,bezier bounding box}}%
	%arrow
	\IfSubStr{\heightarrowbullseye}{auto}%
		{%
			\IfStrEq{\heightarrowbullseye}{dauto}%
				{%raised tikzpicture
					\raisebox{-\depthbullseye}{%
						\begin{tikzpicture}[\colorarrowbullseye,tkzarrowbullseye,#2]
							\ifboolKV[tkzArrowBullsEye]{color}{\intcolortkzArrowBullsEye}{\inttkzArrowBullsEye}
						\end{tikzpicture}%
					}%
				}%
				{%classic tikzpicture
					\begin{tikzpicture}[\colorarrowbullseye,tkzarrowbullseye,#2]
						\ifboolKV[tkzArrowBullsEye]{color}{\intcolortkzArrowBullsEye}{\inttkzArrowBullsEye}
					\end{tikzpicture}%
				}%
		}%
		{%
			%classic tikzpicture
			\begin{tikzpicture}[\colorarrowbullseye,tkzarrowbullseye,#2]
				\ifboolKV[tkzArrowBullsEye]{color}{\intcolortkzArrowBullsEye}{\inttkzArrowBullsEye}
			\end{tikzpicture}%
		}%
}
%alias
\NewCommandCopy\tkzBullsEyeArrow\pictobullseye

%====PICTO BATTERY
\newlength\unittkzbattery
\newlength\tmpheightofcharstkzbattery
\newlength\tmpdepthofcharstkzbattery
\newlength\tmpraisevofkzbattery

\NewDocumentCommand\inttkzbattery{O{}O{}m}{%
	%#1=maincolor
	%#2=fillcolor
	%#3=level
	\xdef\heightbatterylevel{\fpeval{(0.9)/(\pictobatterynblevels)-\pictobatterystretch}}%
	\xdef\offsetbatterylevel{\fpeval{(1-(\pictobatterynblevels)*(\heightbatterylevel))/(\pictobatterynblevels+1)}}%
	\draw[#1,line width=0.125\unittkzbattery,rounded corners=0.033\unittkzbattery,postaction={fill=white}] (-0.33,0) rectangle++ (0.66,1) ;
	\fill[#1,line width=0.05\unittkzbattery,rounded corners=0.01\unittkzbattery] ([yshift=0.0625\unittkzbattery]-0.15,1) rectangle++ (0.3,0.1) ;
	\ifnum#3=0\relax%
	\else%
		\foreach \i in {1,...,#3}{%
			\xintifboolexpr{#3 >= \i}%
				{%
					\fill[#2,line width=0.125\unittkzbattery,rounded corners=0.033\unittkzbattery] ({-0.33+\offsetbatterylevel},{(\i-1)*\heightbatterylevel+(\i)*\offsetbatterylevel}) rectangle++ ({0.66-2*\offsetbatterylevel},{\heightbatterylevel}) ;
				}{}%
		}%
	\fi%
}

\defKV[pictobattery]{%
	maincolor=\def\pictobatterycolor{#1},%
	barcolor=\def\pictobatteryfillcolor{#1},%
	height=\def\pictobatteryheight{#1},%
	scale=\def\pictobatteryscale{#1},%
	innermargin=\def\pictobatterystretch{#1},%
	strut=\def\pictobatterystrut{#1},%
	dstrut=\def\pictobatterydstrut{#1}
}
\setKVdefault[pictobattery]{%
	maincolor={},%
	barcolor=lightgray,%
	height=dauto,%
	flip=false,%
	scale=1,%
	innermargin=0.03,%
	shaded=false,%
	strut=\samplestrutletters,%
	dstrut=\sampledstrutletters
}

\NewDocumentCommand\pictobattery{O{}D<>{}m}{%(OK)
	%#1=clés
	%#2=options tikz
	%#3=données nb/niv
	\restoreKV[pictobattery]%
	\setKV[pictobattery]{#1}%
	\IfStrEq{#3}{}{\xdef\tmpargggg{0}}{\xdef\tmpargggg{#3}}%
	\IfSubStr{\tmpargggg}{/}%
		{%
			\StrCut{\tmpargggg}{/}{\tmpbattlevel}{\pictobatterynblevels}%
		}%
		{%
			\xdef\tmpbattlevel{\tmpargggg}%
			\xdef\pictobatterynblevels{3}%
		}%
	\IfStrEqCase{\pictobatteryheight}{%
		{dauto}{\settototalheight\tmpheightofcharstkzbattery{\pictobatterydstrut}\settodepth\tmpdepthofcharstkzbattery{\pictobatterydstrut}}%
		{auto}{\settototalheight\tmpheightofcharstkzbattery{\pictobatterystrut}\settodepth\tmpdepthofcharstkzbattery{\pictobatterystrut}}%
	}[%
		\setlength\tmpheightofcharstkzbattery{\pictobatteryheight}%
	]%
	\ifboolKV[pictobattery]{shaded}%
		{%
			\xdef\levelshededbattery{\fpeval{(\tmpbattlevel)/(\pictobatterynblevels)*100}}%
			\xdef\pictobatteryfillcolor{\pictobatteryfillcolor!\levelshededbattery}%
		}%
		{%
			\IfStrEq{\pictobatteryfillcolor}{auto}%
				{%
					\IfStrEq{\pictobatterynblevels}{2}%
						{%
							\xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}%
							\xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{orange}}{}%
							\xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{green!75!black}}{}%
						}{}%
					\IfStrEq{\pictobatterynblevels}{3}%
						{%
							\xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}%
							\xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}%
							\xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{orange}}{}%
							\xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{green!75!black}}{}%
						}{}%
					\IfStrEq{\pictobatterynblevels}{4}%
						{%
							\xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}%
							\xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}%
							\xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{orange}}{}%
							\xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{yellow}}{}%
							\xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{green!75!black}}{}%
						}{}%
					\IfStrEq{\pictobatterynblevels}{5}%
						{%
							\xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}%
							\xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}%
							\xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{orange}}{}%
							\xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{yellow}}{}%
							\xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{lime}}{}%
							\xintifboolexpr{\tmpbattlevel == 5}{\xdef\pictobatteryfillcolor{green!75!black}}{}%
						}{}%
					\IfStrEq{\pictobatterynblevels}{6}%
						{%
							\xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}%
							\xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}%
							\xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{orange}}{}%
							\xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{yellow}}{}%
							\xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{lime}}{}%
							\xintifboolexpr{\tmpbattlevel == 5}{\xdef\pictobatteryfillcolor{lime!50!green}}{}%
							\xintifboolexpr{\tmpbattlevel == 6}{\xdef\pictobatteryfillcolor{green!75!black}}{}%
						}{}%
					\IfStrEq{\pictobatterynblevels}{7}%
						{%
							\xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}%
							\xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}%
							\xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{red!50!orange}}{}%
							\xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{orange}}{}%
							\xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{yellow}}{}%
							\xintifboolexpr{\tmpbattlevel == 5}{\xdef\pictobatteryfillcolor{lime}}{}%
							\xintifboolexpr{\tmpbattlevel == 6}{\xdef\pictobatteryfillcolor{lime!50!green}}{}%
							\xintifboolexpr{\tmpbattlevel == 7}{\xdef\pictobatteryfillcolor{green!75!black}}{}%
						}{}%
					\IfStrEq{\pictobatterynblevels}{8}%
						{%
							\xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}%
							\xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}%
							\xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{red!50!orange}}{}%
							\xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{orange}}{}%
							\xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{orange!50!yellow}}{}%
							\xintifboolexpr{\tmpbattlevel == 5}{\xdef\pictobatteryfillcolor{yellow}}{}%
							\xintifboolexpr{\tmpbattlevel == 6}{\xdef\pictobatteryfillcolor{lime}}{}%
							\xintifboolexpr{\tmpbattlevel == 7}{\xdef\pictobatteryfillcolor{lime!50!green}}{}%
							\xintifboolexpr{\tmpbattlevel == 8}{\xdef\pictobatteryfillcolor{green!75!black}}{}%
						}{}%
					\IfStrEq{\pictobatterynblevels}{9}%
						{%
							\xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}%
							\xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}%
							\xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{red!50!orange}}{}%
							\xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{orange}}{}%
							\xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{orange!50!yellow}}{}%
							\xintifboolexpr{\tmpbattlevel == 5}{\xdef\pictobatteryfillcolor{yellow}}{}%
							\xintifboolexpr{\tmpbattlevel == 6}{\xdef\pictobatteryfillcolor{yellow!50!lime}}{}%
							\xintifboolexpr{\tmpbattlevel == 7}{\xdef\pictobatteryfillcolor{lime}}{}%
							\xintifboolexpr{\tmpbattlevel == 8}{\xdef\pictobatteryfillcolor{lime!50!green}}{}%
							\xintifboolexpr{\tmpbattlevel == 9}{\xdef\pictobatteryfillcolor{green!75!black}}{}%
						}{}%
					\IfStrEq{\pictobatterynblevels}{10}%
						{%
							\xintifboolexpr{\tmpbattlevel == 0}{\xdef\pictobatteryfillcolor{}}{}%
							\xintifboolexpr{\tmpbattlevel == 1}{\xdef\pictobatteryfillcolor{red}}{}%
							\xintifboolexpr{\tmpbattlevel == 2}{\xdef\pictobatteryfillcolor{red!50!orange}}{}%
							\xintifboolexpr{\tmpbattlevel == 3}{\xdef\pictobatteryfillcolor{orange}}{}%
							\xintifboolexpr{\tmpbattlevel == 4}{\xdef\pictobatteryfillcolor{orange!50!yellow}}{}%
							\xintifboolexpr{\tmpbattlevel == 5}{\xdef\pictobatteryfillcolor{yellow}}{}%
							\xintifboolexpr{\tmpbattlevel == 6}{\xdef\pictobatteryfillcolor{yellow!50!lime}}{}%
							\xintifboolexpr{\tmpbattlevel == 7}{\xdef\pictobatteryfillcolor{lime}}{}%
							\xintifboolexpr{\tmpbattlevel == 8}{\xdef\pictobatteryfillcolor{lime!50!green}}{}%
							\xintifboolexpr{\tmpbattlevel == 9}{\xdef\pictobatteryfillcolor{green!85!black}}{}%
							\xintifboolexpr{\tmpbattlevel == 10}{\xdef\pictobatteryfillcolor{green!50!black}}{}%
						}{}%
				}%
		{}%
		}%
	\ifboolKV[pictobattery]{flip}%
		{%1,2738
			\xdef\tmpscaaaale{\fpeval{1.2738*\pictobatteryscale}}%
			\setlength\unittkzbattery{\tmpscaaaale\tmpheightofcharstkzbattery}%
			\IfStrEq{\pictobatteryheight}{dauto}%
				{%raided tikzpicture
					\xdef\tmpoffffset{\fpeval{(1-\pictobatteryscale)/2}}%
					\setlength\tmpraisevofkzbattery{\dimexpr\tmpoffffset\tmpheightofcharstkzbattery-\tmpdepthofcharstkzbattery\relax}%
					\raisebox{\tmpraisevofkzbattery}{%
						\begin{tikzpicture}[x=\unittkzbattery,y=\unittkzbattery,rotate=-90,#2]\inttkzbattery[\pictobatterycolor][\pictobatteryfillcolor]{\tmpbattlevel}\end{tikzpicture}%
					}%
				}%
				{%classic tikzpicture
					\begin{tikzpicture}[x=\unittkzbattery,y=\unittkzbattery,rotate=-90,#2]\inttkzbattery[\pictobatterycolor][\pictobatteryfillcolor]{\tmpbattlevel}\end{tikzpicture}%
				}%
		}%
		{%0.8163
			\xdef\tmpscaaaale{\fpeval{0.8163*\pictobatteryscale}}%
			\setlength\unittkzbattery{\tmpscaaaale\tmpheightofcharstkzbattery}%
			\IfStrEq{\pictobatteryheight}{dauto}%
				{%raided tikzpicture
					\xdef\tmpoffffset{\fpeval{(1-\pictobatteryscale)/2}}%
					\setlength\tmpraisevofkzbattery{\dimexpr\tmpoffffset\tmpheightofcharstkzbattery-\tmpdepthofcharstkzbattery\relax}%
					\raisebox{\tmpraisevofkzbattery}{%
						\begin{tikzpicture}[x=\unittkzbattery,y=\unittkzbattery,#2]\inttkzbattery[\pictobatterycolor][\pictobatteryfillcolor]{\tmpbattlevel}\end{tikzpicture}%
					}%
				}%
				{%classic tikzpicture
					\begin{tikzpicture}[x=\unittkzbattery,y=\unittkzbattery,#2]\inttkzbattery[\pictobatterycolor][\pictobatteryfillcolor]{\tmpbattlevel}\end{tikzpicture}%
				}%
		}%
}

%====pictowifi/network
\newlength\pictowifitotheight
\newlength\pictowifidepth

\defKV[pictowifi]{%
	height=\def\pictowifiheight{#1},%
	colors=\def\pictowificolors{#1},%
	style=\def\pictowifistyle{#1},%
	strut=\def\pictowifistrut{#1},%
	dstrut=\def\pictowifidstrut{#1}
}
\setKVdefault[pictowifi]{%
	height=dauto,%
	colors={black/lightgray},%
	style=full,%
	strut=\samplestrutletters,%
	dstrut=\sampledstrutletters
}

\NewDocumentCommand\intpictonetwork{}{%
	%\begin{tikzpicture}[x=\pictowifitotheight,y=\pictowifitotheight,line join=round,line cap=round,rounded corners=0.05\pictowifitotheight]
		\xintifboolexpr{ \tmpwifilevel == 0 }%
			{%
				\foreach \i in {1,...,\tmpwifinblevel}{%
					\xdef\j{\fpeval{(\i-1)*0.225}}%
					\fill[\pictowificolorbg] ({\j\pictowifitotheight},0) rectangle++ ({0.2\pictowifitotheight},{\i/\tmpwifinblevel}) ;
				}%
			}{}%
		\xintifboolexpr{ \tmpwifilevel == \tmpwifinblevel }%
			{%
				\foreach \i in {1,...,\tmpwifinblevel}{%
					\xdef\j{\fpeval{(\i-1)*0.225}}%
					\fill[\pictowificolorframe] ({\j\pictowifitotheight},0) rectangle++ ({0.2\pictowifitotheight},{\i/\tmpwifinblevel}) ;
				}%
			}{}%
		\xintifboolexpr{\tmpwifilevel >= 1 'and' \tmpwifilevel < \tmpwifinblevel}%
			{%
				\foreach \i in {1,...,\tmpwifilevel}{%
					\xdef\j{\fpeval{(\i-1)*0.225}}%
					\fill[\pictowificolorframe] ({\j\pictowifitotheight},0) rectangle++ ({0.2\pictowifitotheight},{\i/\tmpwifinblevel}) ;
				}%
				\foreach \i in {\inteval{\tmpwifilevel+1},...,\tmpwifinblevel}{%
					\xdef\j{\fpeval{(\i-1)*0.225}}%
					\fill[\pictowificolorbg] ({\j\pictowifitotheight},0) rectangle++ ({0.2\pictowifitotheight},{\i/\tmpwifinblevel}) ;
				}%
			}{}%
	%\end{tikzpicture}%
}

\NewDocumentCommand\intpictowififull{}{%
	\fill[\pictowificolorbg] (0,0)--(45:{\tmpwifilevel/\tmpwifinblevel}) arc(45:135:{\tmpwifilevel/\tmpwifinblevel})--cycle ;
	\draw[\pictowificolorframe] (0,0)--(45:1) arc(45:135:1)--cycle ;
}

\NewDocumentCommand\intpictowifibar{}{%
		%rien
		\xintifboolexpr{ \tmpwifilevel == 0 }%
			{%
				\filldraw[\pictowificolorbg] (0,0)--(45:{1/\tmpwifinblevel}) arc(45:135:{1/\tmpwifinblevel})--cycle ;
				\foreach \i in {2,...,\tmpwifinblevel}{%
					\draw[\pictowificolorbg] (45:{\i/\tmpwifinblevel}) arc(45:135:{\i/\tmpwifinblevel}) ;
				}%
			}%
			{}%
		%seulement la première
		\xintifboolexpr{ \tmpwifilevel == 1 }%
			{%
				\filldraw[\pictowificolorframe] (0,0)--(45:{1/\tmpwifinblevel}) arc(45:135:{1/\tmpwifinblevel})--cycle ;
				\foreach \i in {2,...,\tmpwifinblevel}{%
					\draw[\pictowificolorbg] (45:{\i/\tmpwifinblevel}) arc(45:135:{\i/\tmpwifinblevel}) ;
				}%
			}%
			{}%
		%toutes les barres
		\xintifboolexpr{\tmpwifilevel == \tmpwifinblevel}%
			{%
				\filldraw[\pictowificolorframe] (0,0)--(45:{1/\tmpwifinblevel}) arc(45:135:{1/\tmpwifinblevel})--cycle ;
				\foreach \i in {2,...,\tmpwifilevel}{%
					\draw[\pictowificolorframe] (45:{\i/\tmpwifinblevel}) arc(45:135:{\i/\tmpwifinblevel}) ;
				}%
			}%
			{}%
		%les autres cas
		\xintifboolexpr{\tmpwifilevel > 1 'and' \tmpwifilevel < \tmpwifinblevel}%
			{%
				\filldraw[\pictowificolorframe] (0,0)--(45:{1/\tmpwifinblevel}) arc(45:135:{1/\tmpwifinblevel})--cycle ;
				\foreach \i in {2,...,\tmpwifilevel}{%
					\draw[\pictowificolorframe] (45:{\i/\tmpwifinblevel}) arc(45:135:{\i/\tmpwifinblevel}) ;
				}%
				\foreach \i in {\inteval{\tmpwifilevel+1},...,\tmpwifinblevel}{%
					\draw[\pictowificolorbg] (45:{\i/\tmpwifinblevel}) arc(45:135:{\i/\tmpwifinblevel}) ;
				}%
			}%
			{}%
}

\NewDocumentCommand\pictowifi{O{}D<>{}m}{%(OK)
	%#1=clés
	%#2=options tikz
	%#3=données nb/niv
	\restoreKV[pictowifi]%
	\setKV[pictowifi]{#1}%
	\StrCut{\pictowificolors}{/}{\pictowificolorframe}{\pictowificolorbg}%
	\IfSubStr{#3}{/}%
		{%
			\StrCut{#3}{/}{\tmpwifilevel}{\tmpwifinblevel}%
		}%
		{%
			\IfStrEq{#3}{}%
				{%
					\def\tmpwifilevel{0}\def\tmpwifinblevel{4}%
				}%
				{%
					\def\tmpwifilevel{#3}\def\tmpwifinblevel{4}%
				}%
		}%
	\IfSubStr{\pictowifiheight}{auto}%
		{%
			\IfStrEq{\pictowifiheight}{dauto}%
				{%
					\settototalheight\pictowifitotheight{\hbox{\pictowifidstrut}}%
					\setlength\pictowifitotheight{0.95\pictowifitotheight}%
					\settodepth\pictowifidepth{\hbox{\pictowifidstrut}}%
				}{}%
			\IfStrEq{\pictowifiheight}{auto}%
				{%
					\settototalheight\pictowifitotheight{\hbox{\pictowifistrut}}%
					\setlength\pictowifitotheight{0.95\pictowifitotheight}%
					\settodepth\pictowifidepth{\hbox{\pictowifistrut}}%
				}{}%
		}%
		{%
			\setlength\pictowifitotheight{\pictowifiheight}%
		}%
	\IfStrEq{\pictowifiheight}{dauto}%
		{%
			%raised tikzpicture
			\raisebox{-\pictowifidepth}{%
				\begin{tikzpicture}[x=\pictowifitotheight,y=\pictowifitotheight,line width=0.05\pictowifitotheight,line join=round,line cap=round,#2]
					\IfStrEq{\pictowifistyle}{full}{\intpictowififull}{}%
					\IfStrEq{\pictowifistyle}{bar}{\intpictowifibar}{}%
				\end{tikzpicture}%
			}%
		}%
		{%
			%classic tikzpicture
			\begin{tikzpicture}[x=\pictowifitotheight,y=\pictowifitotheight,line width=0.05\pictowifitotheight,line join=round,line cap=round,#2]
				\IfStrEq{\pictowifistyle}{full}{\intpictowififull}{}%
				\IfStrEq{\pictowifistyle}{bar}{\intpictowifibar}{}%
			\end{tikzpicture}%
		}%
}

\NewDocumentCommand\pictonetwork{O{}D<>{}m}{%(OK)
	%#1=clés
	%#2=options tikz
	%#3=données nb/niv
	\restoreKV[pictowifi]%
	\setKV[pictowifi]{#1}%
	\StrCut{\pictowificolors}{/}{\pictowificolorframe}{\pictowificolorbg}%
	\IfSubStr{#3}{/}%
		{%
			\StrCut{#3}{/}{\tmpwifilevel}{\tmpwifinblevel}%
		}%
		{%
			\IfStrEq{#3}{}%
				{%
					\def\tmpwifilevel{0}\def\tmpwifinblevel{4}%
				}%
				{%
					\def\tmpwifilevel{#3}\def\tmpwifinblevel{4}%
				}%
		}%
	\IfSubStr{\pictowifiheight}{auto}%
		{%
			\IfStrEq{\pictowifiheight}{dauto}%
				{%
					\settototalheight\pictowifitotheight{\hbox{\pictowifidstrut}}%
					\settodepth\pictowifidepth{\hbox{\pictowifidstrut}}%
				}{}%
			\IfStrEq{\pictowifiheight}{auto}%
				{%
					\settototalheight\pictowifitotheight{\hbox{\pictowifistrut}}%
					\settodepth\pictowifidepth{\hbox{\pictowifistrut}}%
				}{}%
		}%
		{%
			\setlength\pictowifitotheight{\pictowifiheight}%
		}%
	\IfStrEq{\pictowifiheight}{dauto}%
		{%
			%raised tikzpicture
			\raisebox{-\pictowifidepth}{%
				\begin{tikzpicture}[x=\pictowifitotheight,y=\pictowifitotheight,line join=round,line cap=round,rounded corners=0.05\pictowifitotheight,#2]
					\intpictonetwork%
				\end{tikzpicture}%
			}%
		}%
		{%
			%classic tikzpicture
			\begin{tikzpicture}[x=\pictowifitotheight,y=\pictowifitotheight,line join=round,line cap=round,rounded corners=0.05\pictowifitotheight,#2]
				\intpictonetwork%
			\end{tikzpicture}%
		}%
}

%====PICTO SKILLS
% \def\samplecapletters{AZERTYUIOSDFHKLMWXCVBN}
% \def\sampledptletters{qypqg}

\definecolor{skillgreen}{RGB}{118, 201, 39}
\definecolor{skillorange}{RGB}{255, 153, 0}
\definecolor{skillred}{RGB}{255, 0, 0}

\newlength{\pictoskillheight}
\newlength{\pictoskilldepth}

\defKV[pictoskill]{%
	colors=\def\pictoskillcol{#1},%
	height=\def\pictoskillh{#1},%
	hoffset=\def\pictoskilloffset{#1},%
	voffset=\def\pictoskillvoffset{#1},%
	opacity=\def\pictoskillopacity{#1},%
	strut=\def\pictoskillstrut{#1},%
	dstrut=\def\pictoskilldstrut{#1}
}
\setKVdefault[pictoskill]{%
	colors=gray/lightgray,%
	height=dauto,%
	hoffset=0.175,%
	voffset=0.6,%
	opacity=0.5,%
	strut=\samplestrutletters,%
	dstrut=\sampledstrutletters
}

\NewDocumentCommand\pictoskills{O{}D<>{}m}{%(OK)
	\restoreKV[pictoskill]%
	\setKV[pictoskill]{#1}%
	%levels + opacity
	\IfStrEq{#3}{}%lecture des données
		{\def\pictoskilllevel{1}\def\pictoskilllevelmax{3}}%
		{%
			\IfSubStr{#3}{/}%
				{\StrCut{#3}{/}{\pictoskilllevel}{\pictoskilllevelmax}}%
				{\def\pictoskilllevel{#3}\def\pictoskilllevelmax{3}}%
		}%
	\xdef\pictoskillopacity{\xintfloateval{100*\pictoskillopacity}}%
	\IfSubStr{\pictoskillcol}{/}%
		{%
			\StrCut{\pictoskillcol}{/}{\pictoskillcolA}{\pictoskillcolB}%
		}%
		{%
			\def\pictoskillcolB{\pictoskillcol!\pictoskillopacity!white}\def\pictoskillcolA{\pictoskillcol}%
		}%
	%height
	\IfStrEqCase{\pictoskillh}{%
		{auto}%
		{%
			\settototalheight{\pictoskillheight}{\hbox{\pictoskillstrut}}%
			\settodepth{\pictoskilldepth}{\hbox{\pictoskillstrut}}%
			%classic tikzpicture
			\begin{tikzpicture}[x=1.125\pictoskillheight,y=0.975\pictoskillheight,#2]
		}%
		{dauto}%
		{%
			\settototalheight{\pictoskillheight}{\hbox{\pictoskilldstrut}}%
			\settodepth{\pictoskilldepth}{\hbox{\pictoskilldstrut}}%
			%raised tikzpicture
			\begin{tikzpicture}[x=1.125\pictoskillheight,y=0.975\pictoskillheight,baseline=0.975\pictoskilldepth,#2]
		}%
		}[%
			\setlength\pictoskillheight{\pictoskillh}%
			\setlength\pictoskilldepth{0pt}%
			%classic tikzpicture
			\begin{tikzpicture}[x=1.125\pictoskillheight,y=0.975\pictoskillheight,#2]
		]%
	%===test offset
	\xdef\pictoskilllarg{\fpeval{(1-\pictoskilloffset)/\pictoskilllevelmax}}%
	\xdef\pictoskilloffsetindiv{\fpeval{(\pictoskilloffset)/(\pictoskilllevelmax+1)}}%
	%===fintest offset
	\clip (0,0)--++(0,\pictoskillvoffset)--(1,1)--(1,0)--cycle;
	\foreach \i in {1,...,\pictoskilllevelmax}{%
		\xintifboolexpr{\i <= \pictoskilllevel}%
			{%
				\fill[\pictoskillcolA] ({(\i*\pictoskilloffsetindiv+(\i-1)*\pictoskilllarg},0) rectangle++ ({\pictoskilllarg},1) ;
			}%
			{%
				\fill[\pictoskillcolB] ({(\i*\pictoskilloffsetindiv+(\i-1)*\pictoskilllarg},0) rectangle++ ({\pictoskilllarg},1) ;
			}%
	}%
	\end{tikzpicture}%
}

%aliases
\NewCommandCopy\pictoskill\pictoskills
\NewDocumentCommand\pictoskillsgreen{ O{} }{\pictoskills[#1,colors=skillgreen]{1}}
\NewDocumentCommand\pictoskillsorange{ O{} }{\pictoskills[#1,colors=skillorange]{2}}
\NewDocumentCommand\pictoskillsred{ O{} }{\pictoskills[#1,colors=skillred]{3}}

%====PICTO PILL
\newlength\pictopillheight
\newlength\pictopilldepth

\defKV[pictopill]{%
	colors=\def\pictopillcolors{#1},%
	offset=\def\pictopilloffset{#1},%
	height=\def\pictopilltypeheight{#1},%
	scale=\def\pictopillscale{#1},%
	strut=\def\pictopillstrut{#1},%
	dstrut=\def\pictopilldstrut{#1}
}

\setKVdefault[pictopill]{%
	colors={black/lightgray},%
	offset=0.1,%
	height=dauto,%
	scale=0.9,%
	strut=\samplestrutletters,%
	dstrut=\sampledstrutletters
}

\NewDocumentCommand\pictopillint{}{%
	%left part
	\xintifboolexpr{\pictotmpnbpills >= 1}%
		{%
			\draw[\pictopillcolorframe,fill=\pictopillcolorbg] (-\pictopilloffset\pictopillheight,0.4625\pictopillheight) --++ (-0.6\pictopillheight,0) to[out=180,in=90]++ (-0.4625\pictopillheight,-0.4625\pictopillheight)  to[out=-90,in=180]++ (0.4625\pictopillheight,-0.4625\pictopillheight) --++ (0.6\pictopillheight,0) -- cycle;
		}%
		{%
			\draw[\pictopillcolorframe] (-\pictopilloffset\pictopillheight,0.4625\pictopillheight) --++ (-0.6\pictopillheight,0) to[out=180,in=90]++ (-0.4625\pictopillheight,-0.4625\pictopillheight)  to[out=-90,in=180]++ (0.4625\pictopillheight,-0.4625\pictopillheight) --++ (0.6\pictopillheight,0) -- cycle;
		}%
	%middle(s) part
	\foreach \i in {2,...,\inteval{\pictotmpnbtotpills-1}}{%
		\xdef\j{\inteval{\i-2}}%
		\xdef\k{\fpeval{(\i-1)*\pictopilloffset}}%
		\xintifboolexpr{\pictotmpnbpills >= \i}%
			{%
				\draw[\pictopillcolorframe,fill=\pictopillcolorbg] ({\j\pictopillheight+\k\pictopillheight},-0.4625\pictopillheight) rectangle++ (0.925\pictopillheight,0.925\pictopillheight) ;
			}%
			{%
				\draw[\pictopillcolorframe] ({\j\pictopillheight+\k\pictopillheight},-0.4625\pictopillheight) rectangle++ (0.925\pictopillheight,0.925\pictopillheight) ;
			}%
	}%
	%right part
	\xdef\tmpargAAA{\inteval{\pictotmpnbtotpills-2}}%
	\xdef\tmpargBBB{\fpeval{(\pictotmpnbtotpills-1)*\pictopilloffset}}%
	\xintifboolexpr{\pictotmpnbpills == \pictotmpnbtotpills}%
		{%
			\draw[\pictopillcolorframe,fill=\pictopillcolorbg] ({\tmpargAAA\pictopillheight+\tmpargBBB\pictopillheight},0.4625\pictopillheight) --++ (0.6\pictopillheight,0) to[out=0,in=90]++ (0.4625\pictopillheight,-0.4625\pictopillheight) to[out=-90,in=0]++ (-0.4625\pictopillheight,-0.4625\pictopillheight) --++ (-0.6\pictopillheight,0) -- cycle;
		}%
		{%
			\draw[\pictopillcolorframe] ({\tmpargAAA\pictopillheight+\tmpargBBB\pictopillheight},0.4625\pictopillheight) --++ (0.6\pictopillheight,0) to[out=0,in=90]++ (0.4625\pictopillheight,-0.4625\pictopillheight) to[out=-90,in=0]++ (-0.4625\pictopillheight,-0.4625\pictopillheight) --++ (-0.6\pictopillheight,0) -- cycle;
		}%
}

\NewDocumentCommand{\pictopill}{O{}D<>{}m}{%(OK) modif avec hauteur
	%#1=clés
	%#2=options tikz
	%#3=données nb/nblev
	\restoreKV[pictopill]%
	\setKV[pictopill]{#1}%
	%lecture des données
	\IfSubStr{#3}{/}%
		{%
			\StrCut{#3}{/}{\pictotmpnbpills}{\pictotmpnbtotpills}%param complet
		}%
		{%
			\IfStrEq{#3}{}%
			{\def\pictotmpnbpills{0}\def\pictotmpnbtotpills{3}}%si vide 0/3
			{\def\pictotmpnbpills{#3}\def\pictotmpnbtotpills{3}}%sinon #3/3
		}%
	%couleurs
	\IfSubStr{\pictopillcolors}{/}%
		{%
			\StrCut{\pictopillcolors}{/}{\pictopillcolorframe}{\pictopillcolorbg}%
		}%
		{%
			\def\pictopillcolorframe{\pictopillcolors}\def\pictopillcolorbg{\pictopillcolors}%
		}%
	%lengths
	\IfSubStr{\pictopilltypeheight}{auto}%
		{%
			\IfStrEq{\pictopilltypeheight}{auto}%
				{%
					\settototalheight{\pictopillheight}{\hbox{\pictopillstrut}}%
				}{}%
			\IfStrEq{\pictopilltypeheight}{dauto}%
				{%
					\settototalheight{\pictopillheight}{\hbox{\pictopilldstrut}}%
					\settodepth{\pictopilldepth}{\hbox{\pictopilldstrut}}%
				}{}%
		}%
		{%
			\setlength\pictopillheight{\pictopilltypeheight}%
		}%
	\IfStrEq{\pictopilltypeheight}{dauto}%
		{%
			\begin{tikzpicture}[scale=\pictopillscale,line width=\fpeval{0.075*\pictopillscale}\pictopillheight,baseline=-1.25\pictopilldepth,#2]
				\pictopillint
			\end{tikzpicture}%
		}%
		{%
			\begin{tikzpicture}[scale=\pictopillscale,line width=\fpeval{0.075*\pictopillscale}\pictopillheight,#2]
				\pictopillint
			\end{tikzpicture}%
		}%
}

%====TRAFFICLIGHT
\newlength\pictotrafficheight
\newlength\pictotrafficdepth

\defKV[pictotraffic]{%
	maincolor=\def\pictotrafficcolor{#1},%
	listcolors=\def\pictotrafficcolors{#1},%
	height=\def\pictotraffictypeheight{#1},%
	scale=\def\pictotrafficscale{#1},%
	strut=\def\pictotrafficstrut{#1},%
	dstrut=\def\pictotrafficdstrut{#1}
}

\setKVdefault[pictotraffic]{%
	maincolor={black},%
	listcolors={red,yellow!75!orange,green!50!black},%
	height=dauto,%
	scale=1,%
	borders=false,%
	strut=\samplestrutletters,%
	dstrut=\sampledstrutletters
}
%rayon = 0.76/6 = 0,125

\NewDocumentCommand\pictopictotrafficint{}{%
	\def\offsethtrafficpicto{3.5}%
	\xdef\pictotrafficradius{\fpeval{(1-0.15)/6-0.015}}%
	\xdef\pictotrafficoffset{\fpeval{(0.15)/3}}%
	%bg
	\fill[\pictotrafficcolor] ({-\pictotrafficradius\pictotrafficheight-\fpeval{1.5*\pictotrafficoffset}\pictotrafficheight},0) rectangle ({\pictotrafficradius\pictotrafficheight+\fpeval{1.5*\pictotrafficoffset}\pictotrafficheight},{\pictotrafficheight}) ;
	%rounded
	\fill[\pictotrafficcolor,line join=round] ({-\pictotrafficradius\pictotrafficheight-\fpeval{\offsethtrafficpicto*\pictotrafficoffset}\pictotrafficheight},{\pictotrafficheight-\pictotrafficoffset\pictotrafficheight}) -- ({\pictotrafficradius\pictotrafficheight+\fpeval{\offsethtrafficpicto*\pictotrafficoffset}\pictotrafficheight},{\pictotrafficheight-\pictotrafficoffset\pictotrafficheight}) -- (0,{\pictotrafficheight-\pictotrafficoffset\pictotrafficheight-\fpeval{2*\pictotrafficradius}\pictotrafficheight}) -- cycle ;
	\fill[\pictotrafficcolor,line join=round] ({-\pictotrafficradius\pictotrafficheight-\fpeval{\offsethtrafficpicto*\pictotrafficoffset}\pictotrafficheight},{0.5\pictotrafficheight+\pictotrafficradius\pictotrafficheight}) -- ({\pictotrafficradius\pictotrafficheight+\fpeval{\offsethtrafficpicto*\pictotrafficoffset}\pictotrafficheight},{0.5\pictotrafficheight+\pictotrafficradius\pictotrafficheight}) -- (0,{0.5\pictotrafficheight-\pictotrafficradius\pictotrafficheight}) -- cycle ;
	\fill[\pictotrafficcolor,line join=round] ({-\pictotrafficradius\pictotrafficheight-\fpeval{\offsethtrafficpicto*\pictotrafficoffset}\pictotrafficheight},{\pictotrafficoffset\pictotrafficheight+\fpeval{2*\pictotrafficradius}\pictotrafficheight}) -- ({\pictotrafficradius\pictotrafficheight+\fpeval{\offsethtrafficpicto*\pictotrafficoffset}\pictotrafficheight},{\pictotrafficoffset\pictotrafficheight+\fpeval{2*\pictotrafficradius}\pictotrafficheight}) -- (0,{\pictotrafficoffset\pictotrafficheight}) -- cycle ;
	%colors basis
	\ifboolKV[pictotraffic]{borders}%
		{%
			\draw[white,fill=\pictotrafficcolor!50!white] (0,{\pictotrafficoffset\pictotrafficheight+\pictotrafficradius\pictotrafficheight}) circle[radius={\pictotrafficradius\pictotrafficheight}] ;
			\draw[white,fill=\pictotrafficcolor!50!white] (0,{0.5\pictotrafficheight}) circle[radius={\pictotrafficradius\pictotrafficheight}] ;
			\draw[white,fill=\pictotrafficcolor!50!white] (0,{\pictotrafficheight-\pictotrafficoffset\pictotrafficheight-\pictotrafficradius\pictotrafficheight}) circle[radius={\pictotrafficradius\pictotrafficheight}] ;
			%red
			\IfSubStr{\pictotrafficlevel}{1}%
				{%
					\draw[white,fill={\lstcolorslisttraffic[1]}] (0,{\pictotrafficheight-\pictotrafficoffset\pictotrafficheight-\pictotrafficradius\pictotrafficheight}) circle[radius={\pictotrafficradius\pictotrafficheight}] ;
				}{}%
			%orange
			\IfSubStr{\pictotrafficlevel}{2}%
				{%
					\draw[white,{fill=\lstcolorslisttraffic[2]}] (0,{0.5\pictotrafficheight}) circle[radius={\pictotrafficradius\pictotrafficheight}] ;
				}{}%
			%green
			\IfSubStr{\pictotrafficlevel}{3}%
				{%
					\draw[white,fill={\lstcolorslisttraffic[3]}] (0,{\pictotrafficoffset\pictotrafficheight+\pictotrafficradius\pictotrafficheight}) circle[radius={\pictotrafficradius\pictotrafficheight}] ;
				}{}%
		}%
		{%
			\filldraw[\pictotrafficcolor!50!white] (0,{\pictotrafficoffset\pictotrafficheight+\pictotrafficradius\pictotrafficheight}) circle[radius={\pictotrafficradius\pictotrafficheight}] ;
			\filldraw[\pictotrafficcolor!50!white] (0,{0.5\pictotrafficheight}) circle[radius={\pictotrafficradius\pictotrafficheight}] ;
			\filldraw[\pictotrafficcolor!50!white] (0,{\pictotrafficheight-\pictotrafficoffset\pictotrafficheight-\pictotrafficradius\pictotrafficheight}) circle[radius={\pictotrafficradius\pictotrafficheight}] ;
			%red
			\IfSubStr{\pictotrafficlevel}{1}%
				{%
					\filldraw[{\lstcolorslisttraffic[1]}] (0,{\pictotrafficheight-\pictotrafficoffset\pictotrafficheight-\pictotrafficradius\pictotrafficheight}) circle[radius={\pictotrafficradius\pictotrafficheight}] ;
				}{}%
			%orange
			\IfSubStr{\pictotrafficlevel}{2}%
				{%
					\filldraw[{\lstcolorslisttraffic[2]}] (0,{0.5\pictotrafficheight}) circle[radius={\pictotrafficradius\pictotrafficheight}] ;
				}{}%
			%green
			\IfSubStr{\pictotrafficlevel}{3}%
				{%
					\filldraw[{\lstcolorslisttraffic[3]}] (0,{\pictotrafficoffset\pictotrafficheight+\pictotrafficradius\pictotrafficheight}) circle[radius={\pictotrafficradius\pictotrafficheight}] ;
				}{}%
		}%
}

\NewDocumentCommand{\pictotraffic}{O{}D<>{}m}{%(OK) modif avec hauteur
	%#1=clés
	%#2=options tikz
	%#3=données level (0/1/2/3)
	\restoreKV[pictotraffic]%
	\setKV[pictotraffic]{#1}%
	%lecture des données
	\def\pictotrafficlevel{#3}%
	%colors
	\setsepchar{,}%
	\readlist\lstcolorslisttraffic{\pictotrafficcolors}%
	%lengths
	\IfSubStr{\pictotraffictypeheight}{auto}%
		{%
			\IfStrEq{\pictotraffictypeheight}{auto}%
				{%
					\settototalheight{\pictotrafficheight}{\hbox{\pictotrafficstrut}}%
				}{}%
			\IfStrEq{\pictotraffictypeheight}{dauto}%
				{%
					\settototalheight{\pictotrafficheight}{\hbox{\pictotrafficdstrut}}%
					\settodepth{\pictotrafficdepth}{\hbox{\pictotrafficdstrut}}%
				}{}%
		}%
		{%
			\setlength\pictotrafficheight{\pictotraffictypeheight}%
		}%
	\IfStrEq{\pictotraffictypeheight}{dauto}%
		{%
			\begin{tikzpicture}[scale=\pictotrafficscale,line width=\fpeval{0.015*\pictotrafficscale}\pictotrafficheight,rounded corners=\fpeval{0.05*\pictotrafficscale}\pictotrafficheight,baseline={\pictotrafficdepth-\fpeval{(1-\pictotrafficscale)/2}\pictotrafficheight},transform shape,#2] %OK
				\pictopictotrafficint
			\end{tikzpicture}%
		}%
		{%
			\begin{tikzpicture}[scale=\pictotrafficscale,line width=\fpeval{0.015*\pictotrafficscale}\pictotrafficheight,rounded corners=\fpeval{0.05*\pictotrafficscale}\pictotrafficheight,transform shape,#2]
				\pictopictotrafficint
			\end{tikzpicture}%
		}%
}

%====MINICALENDAR
\newlength\tmptotalheightcurrenttext
\newlength\tmpdepthcurrenttext

\defKV[minictikzcalendar]{%
	color=\def\minictikzcalendarcol{#1},%
	height=\def\minictikzcalendarheight{#1},%
	monthcolor=\def\minictikzcalendarcolmois{#1},%
	daycolor=\def\minictikzcalendarcoljour{#1},%
	strut=\def\minictikzcalendarstrut{#1},%
	dstrut=\def\minictikzcalendardstrut{#1}
}
\setKVdefault[minictikzcalendar]{%
	color=black,%
	height=dauto,%
	monthcolor=white,%
	daycolor=black,%
	strut=\samplestrutletters,%
	dstrut=\sampledstrutletters
}

\tikzset{minicalmonth/.style={font=\sffamily\bfseries,\minictikzcalendarcolmois}}
\tikzset{minicalday/.style={font=\sffamily\bfseries,\minictikzcalendarcoljour}}

\NewDocumentCommand\pictocalendar{O{}D<>{}m}{%
	\restoreKV[minictikzcalendar]%
	\setKV[minictikzcalendar]{#1}%
	\StrCut{#3}{/}{\minictikzcalendarday}{\minictikzcalendarmonth}%
	\IfStrEqCase{\minictikzcalendarheight}{%
		{auto}%
		{%
			\settototalheight\tmptotalheightcurrenttext{\hbox{\minictikzcalendarstrut}}%
			\tikzset{minicaldepth/.style={x=0.975\tmptotalheightcurrenttext,y=0.975\tmptotalheightcurrenttext}}%
		}%
		{dauto}%
		{%
			\settototalheight\tmptotalheightcurrenttext{\hbox{\minictikzcalendardstrut}}%
			\settodepth\tmpdepthcurrenttext{\hbox{\minictikzcalendardstrut}}%
			\tikzset{minicaldepth/.style={x=0.925\tmptotalheightcurrenttext,y=0.925\tmptotalheightcurrenttext,baseline=0.8125\tmpdepthcurrenttext}}%
		}%
	}[%
		\setlength\tmptotalheightcurrenttext{\minictikzcalendarheight}%
		\tikzset{minicaldepth/.style={x=\tmptotalheightcurrenttext,y=\tmptotalheightcurrenttext}}%
	]%
	\begin{tikzpicture}[line width=0.0375\tmptotalheightcurrenttext,minicaldepth,#2]
		\draw[\minictikzcalendarcol] (0,0) {[rounded corners=0.075\tmptotalheightcurrenttext] --++(0,1)--++(1,0)}--++(0,-1)--cycle ;
		\filldraw[\minictikzcalendarcol] (0,0.7) {[rounded corners=0.075\tmptotalheightcurrenttext] --(0,1)--++(1,0)}--(1,0.7)--cycle ;
		\clip (0,0) {[rounded corners=0.075\tmptotalheightcurrenttext] --++(0,1)--++(1,0)}--++(0,-1)--cycle ;
		\draw (0.5,0.85) node[inner sep=0pt,minicalmonth] {\resizebox{!}{0.175\tmptotalheightcurrenttext}{\vphantom{azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN}\minictikzcalendarmonth}} ;
		\draw[black] (0.5,0.35) node[inner sep=0pt,minicalday] {\resizebox{!}{0.425\tmptotalheightcurrenttext}{\vphantom{0123456789}\minictikzcalendarday}} ;
	\end{tikzpicture}%
}

%====CLIPPY
\defKV[tkzclippy]{%
	height=\def\tkzclippyunit{#1},%
	color=\def\tkzclippycolor{#1},%
	eyecolor=\def\tkzclippyeyecolor{#1},%
	style=\def\tkzclippyeyestyle{#1},%
	rotate=\def\tkzclippyerotate{#1},%
	ratio=\def\tkzclippyeratio{#1},%
	strut=\def\tkzclippystrut{#1},%
	dstrut=\def\tkzclippydstrut{#1}
}
\setKVdefault[tkzclippy]{%
	height=dauto,
	color=black,%
	eyecolor=black,%
	style=normal,%
	rotate=0,%
	ratio=0.225,%
	strut=\samplestrutletters,%
	dstrut=\sampledstrutletters
}

\newlength\clippyunit
\newlength\clippydepthunit
\tikzset{tkzclippyborder/.style={\tkzclippycolor,line width=0.025\clippyunit,line cap=round}}
\tikzset{tkzclippyborderbrow/.style={\tkzclippycolor,line width=0.025\clippyunit,line cap=round}}
\tikzset{tkzclippyeyeborder/.style={\tkzclippycolor,line width=0.015\clippyunit,fill=white}}
\tikzset{tkzclippyeyeinner/.style={line width=0.0125\clippyunit,\tkzclippyeyecolor}}

\newcommand\intclippybody{%
	\draw[tkzclippyborder] (0,0.6)--(0,0.2)--({\tkzclippyeratio},0.2)--(\tkzclippyeratio,1)--(-0.0375,1)--++(0,-1)--++({\tkzclippyeratio+0.075},0)--++(0,0.4)--++(65:0.1) ;
}
\newcommand\intclippyeyes{%
	\draw[tkzclippyeyeborder] (-0.0375,0.75) circle[radius=0.075] ;
	\draw[tkzclippyeyeborder] ({\tkzclippyeratio},0.75) circle[radius=0.075] ;
	\filldraw[tkzclippyeyeinner] (-0.0375,0.75) circle[radius=0.0325] ;
	\filldraw[tkzclippyeyeinner] ({\tkzclippyeratio},0.75) circle[radius=0.0325] ;
}
\newcommand\intclippyeyebrow[6]{%
	%#1=lR / %#2=lL / %#3=rR / %#4=lL / %#5=bendl / %#6=bendr
	\draw[tkzclippyborderbrow] (0.035,#1) to[#5] (-0.09,#2) ;
	\draw[tkzclippyborderbrow] ({\tkzclippyeratio-0.0725},#3) to[#6] ({\tkzclippyeratio+0.0525},#4) ;
}

\NewDocumentCommand\pictoclippy{ O{} D<>{} }{%
	\restoreKV[tkzclippy]%
	\setKV[tkzclippy]{#1}%
	\IfSubStr{\tkzclippyunit}{auto}%
		{%
			\IfStrEq{\tkzclippyunit}{auto}%
				{%
					\settototalheight\clippyunit{\hbox{\tkzclippystrut}}%
					\setlength\clippydepthunit{-0.015\clippyunit}%
				}%
				{%
					\settototalheight\clippyunit{\hbox{\tkzclippydstrut}}%
					\settodepth\clippydepthunit{\hbox{\tkzclippydstrut}}%
				}%
		}%
		{%
			\setlength\clippyunit{\tkzclippyunit}%
			\setlength\clippydepthunit{0pt}%
		}%
	\begin{tikzpicture}[x=\clippyunit,y=\clippyunit,scale=0.9756,rounded corners=0.0875\clippyunit,baseline=0.95\clippydepthunit,rotate=\tkzclippyerotate,#2,inner sep=0pt]
		\intclippybody
		\intclippyeyes
		\IfStrEqCase{\tkzclippyeyestyle}{%
			{normal}{\intclippyeyebrow{0.875}{0.875}{0.875}{0.875}{}{}}%
			{angry}{\intclippyeyebrow{0.85}{0.875}{0.85}{0.875}{}{}}%
			{happy}{\intclippyeyebrow{0.875}{0.85}{0.875}{0.85}{}{}}%
			{anghappy}{\intclippyeyebrow{0.85}{0.875}{0.875}{0.85}{}{}}%
			{happangry}{\intclippyeyebrow{0.875}{0.85}{0.85}{0.875}{}{}}%
			{surprised}{\intclippyeyebrow{0.875}{0.875}{0.875}{0.875}{bend right=45}{bend left=45}}%
			{confused}{\intclippyeyebrow{0.875}{0.875}{0.875}{0.875}{bend right=45}{bend right=22.5}}%
		}%
	\end{tikzpicture}%
}

%====DBALLS
\defKV[pictodball]{height=\def\pictodballheight{#1},strut=\def\pictodballstrut{#1},dstrut=\def\pictodballdstrut{#1},maincolor=\colorlet{maindball}{#1},starcolor=\colorlet{stardball}{#1}}
\setKVdefault[pictodball]{height=dauto,dstrut=\sampledstrutletters,strut=\samplestrutletters,bw=false,maincolor=orange,starcolor=purple!75!red}

\newlength\dragonb@total@height
\newlength\dragonb@depth
\def\dballbigradius{0.12}
\def\dballsmallradius{0.05}
\tikzstyle{scorestars}=[star,star points=5,star point ratio=2.25]%
\colorlet{maindball}{orange}
\colorlet{stardball}{purple!50!red}

\newcommand\intdballstar[2][18]{%1 = rotate, %2=pos
	\begin{scope}[shift={#2},rotate=#1]
	\draw[dball stars] 
		(0:\dballbigradius\dragonb@total@height) -- 
		(36:\dballsmallradius\dragonb@total@height) -- 
		(72:\dballbigradius\dragonb@total@height) -- 
		(108:\dballsmallradius\dragonb@total@height) -- 
		(144:\dballbigradius\dragonb@total@height) -- 
		(180:\dballsmallradius\dragonb@total@height) -- 
		(216:\dballbigradius\dragonb@total@height) -- 
		(252:\dballsmallradius\dragonb@total@height) -- 
		(288:\dballbigradius\dragonb@total@height) -- 
		(324:\dballsmallradius\dragonb@total@height) -- 
		cycle;
	\end{scope}
}

\NewDocumentCommand\pictodball{ O{} D<>{} m }{%
	\restoreKV[pictodball]%
	\setKV[pictodball]{#1}%
	\if\relax\detokenize{#3}\relax%
		\def\dballnbstars{0}%
	\else%
		\def\dballnbstars{#3}%
	\fi%
	\IfStrEqCase{\pictodballheight}{%
		{dauto}%
			{%
				\settototalheight\dragonb@total@height{\hbox{\pictodballdstrut}}%
				\settodepth\dragonb@depth{\hbox{\pictodballdstrut}}%
				\begin{tikzpicture}[baseline=-0.5\dragonb@total@height+\dragonb@depth,x=\dragonb@total@height,y=\dragonb@total@height,line width=0.03\dragonb@total@height,#2]
			}%
		{auto}%
			{%
				\settototalheight\dragonb@total@height{\hbox{\pictodballstrut}}%
				\settodepth\dragonb@depth{\hbox{\pictodballstrut}}%
				\begin{tikzpicture}[baseline=-0.5\dragonb@total@height+\dragonb@depth,x=\dragonb@total@height,y=\dragonb@total@height,line width=0.03\dragonb@total@height,#2]
			}%
	}[%
		\setlength\dragonb@total@height{\pictodballheight}%
		\begin{tikzpicture}[x=\dragonb@total@height,y=\dragonb@total@height,line width=0.03\dragonb@total@height,#2]
	]%
		%styles
		\ifboolKV[pictodball]{bw}%
			{%
				\tikzset{dball background/.style={lightgray!15}}
				\tikzset{dball dark background/.style={gray!50}}
				%\tikzset{dball stars/.style={line width=0.005\dragonb@total@height,fill=darkgray!50!black,draw=darkgray!25!black,rounded corners=0.01\dragonb@total@height}}
				\tikzset{dball stars/.style={fill=darkgray!50!black,draw=none,rounded corners=0.02\dragonb@total@height}}
				\tikzset{dball shadow/.style={lightgray!37!white}}
				\tikzset{dball border/.style={black}}
			}%
			{%
				\tikzset{dball background/.style={maindball!75}}
				\tikzset{dball dark background/.style={maindball!75!gray}}
				\tikzset{dball stars/.style={fill=stardball!88,draw=none,rounded corners=0.02\dragonb@total@height}}
				%\tikzset{dball stars/.style={line width=0.005\dragonb@total@height,fill=stardball!88,draw=stardball,rounded corners=0.01\dragonb@total@height}}
				\tikzset{dball shadow/.style={lightgray!37!white}}
				\tikzset{dball border/.style={maindball!10!black}}
			}%
		%beginball
		\fill[dball dark background] (0,0) circle[radius=0.5\dragonb@total@height] ;
		\begin{scope}
			\clip (0,0) circle[radius=0.5\dragonb@total@height] ;
			\fill[dball background] (-0.2\dragonb@total@height,0.125\dragonb@total@height) circle[radius=0.55\dragonb@total@height] ;
		\end{scope}
		\fill[dball shadow,rotate=20] (0,0.375\dragonb@total@height) circle[x radius=0.15\dragonb@total@height,y radius=0.075\dragonb@total@height] ;
		\fill[dball shadow,rotate=105] (0,0.425\dragonb@total@height) circle[x radius=0.10\dragonb@total@height,y radius=0.025\dragonb@total@height] ;
		\draw[dball border] (0,0) circle[radius=0.485\dragonb@total@height] ;
		%endball
		%beginstars
		\ifnum\dballnbstars=1
			\intdballstar{(0,0)}
		\fi
		\ifnum\dballnbstars=2
			\intdballstar{(135:0.15\dragonb@total@height)}
			\intdballstar{(-45:0.15\dragonb@total@height)}
		\fi
		\ifnum\dballnbstars=3
			\intdballstar{(90:0.175\dragonb@total@height)}
			\intdballstar{(-30:0.175\dragonb@total@height)}
			\intdballstar{(-150:0.175\dragonb@total@height)}
		\fi
		\ifnum\dballnbstars=4
			\intdballstar{(45:0.175\dragonb@total@height)}
			\intdballstar{(-45:0.2\dragonb@total@height)}
			\intdballstar{(-135:0.175\dragonb@total@height)}
			\intdballstar{(135:0.2\dragonb@total@height)}
		\fi
		\ifnum\dballnbstars=5
			\intdballstar{(10:0.25\dragonb@total@height)}
			\intdballstar{(82:0.25\dragonb@total@height)}
			\intdballstar{(154:0.25\dragonb@total@height)}
			\intdballstar{(226:0.25\dragonb@total@height)}
			\intdballstar{(298:0.25\dragonb@total@height)}
		\fi
		\ifnum\dballnbstars=6
			\intdballstar{(0,0)}
			\intdballstar{(10:0.25\dragonb@total@height)}
			\intdballstar{(82:0.25\dragonb@total@height)}
			\intdballstar{(154:0.25\dragonb@total@height)}
			\intdballstar{(226:0.25\dragonb@total@height)}
			\intdballstar{(298:0.25\dragonb@total@height)}
		\fi
		\ifnum\dballnbstars=7
			\intdballstar{(0,0)}
			\intdballstar{(0:0.25\dragonb@total@height)}
			\intdballstar{(60:0.25\dragonb@total@height)}
			\intdballstar{(120:0.25\dragonb@total@height)}
			\intdballstar{(180:0.25\dragonb@total@height)}
			\intdballstar{(240:0.25\dragonb@total@height)}
			\intdballstar{(300:0.25\dragonb@total@height)}
		\fi
		\ifnum\dballnbstars=8
			\intdballstar{(0,0)}
			\intdballstar{({0*360/7}:0.275\dragonb@total@height)}
			\intdballstar{({1*360/7}:0.275\dragonb@total@height)}
			\intdballstar{({2*360/7}:0.275\dragonb@total@height)}
			\intdballstar{({3*360/7}:0.275\dragonb@total@height)}
			\intdballstar{({4*360/7}:0.275\dragonb@total@height)}
			\intdballstar{({5*360/7}:0.275\dragonb@total@height)}
			\intdballstar{({6*360/7}:0.275\dragonb@total@height)}
		\fi
		\ifnum\dballnbstars=9
			\intdballstar{(0,0)}
			\intdballstar{({0*360/8}:0.29\dragonb@total@height)}
			\intdballstar{({1*360/8}:0.29\dragonb@total@height)}
			\intdballstar{({2*360/8}:0.29\dragonb@total@height)}
			\intdballstar{({3*360/8}:0.29\dragonb@total@height)}
			\intdballstar{({4*360/8}:0.29\dragonb@total@height)}
			\intdballstar{({5*360/8}:0.29\dragonb@total@height)}
			\intdballstar{({6*360/8}:0.29\dragonb@total@height)}
			\intdballstar{({7*360/8}:0.29\dragonb@total@height)}
		\fi
		\ifnum\dballnbstars=10
			\intdballstar{(0,0)}
			\intdballstar{({0*360/9}:0.31\dragonb@total@height)}
			\intdballstar{({1*360/9}:0.31\dragonb@total@height)}
			\intdballstar{({2*360/9}:0.31\dragonb@total@height)}
			\intdballstar{({3*360/9}:0.31\dragonb@total@height)}
			\intdballstar{({4*360/9}:0.31\dragonb@total@height)}
			\intdballstar{({5*360/9}:0.31\dragonb@total@height)}
			\intdballstar{({6*360/9}:0.31\dragonb@total@height)}
			\intdballstar{({7*360/9}:0.31\dragonb@total@height)}
			\intdballstar{({8*360/9}:0.31\dragonb@total@height)}
		\fi
		%endstars
	\end{tikzpicture}%
}

%====GENERIC MACRO ?
\NewDocumentCommand\tkzpicto{O{}D<>{}m}{%
	\IfSubStr{#3}{wifi}{%
		\StrBehind{#3}{=}[\tmpargggggwifi]%
		\pictowifi[#1]<#2>{\tmpargggggwifi}%
	}{}%
	\IfSubStr{#3}{network}{%
		\StrBehind{#3}{=}[\tmpargggggnetwork]%
		\pictonetwork[#1]<#2>{\tmpargggggnetwork}%
	}{}%
	\IfSubStr{#3}{stars}{%
		\StrBehind{#3}{=}[\tmpargggggstars]%
		\pictostars[#1]<#2>{\tmpargggggstars}%
	}{}%
	\IfSubStr{#3}{speedo}{%
		\StrBehind{#3}{=}[\tmpargggggspeedo]%
		\pictospeedometer[#1]<#2>{\tmpargggggspeedo}%
	}{}%
	\IfStrEq{#3}{bullseye}{{\pictobullseye[#1]<#2>}}{}%
	\IfSubStr{#3}{battery}{%
		\StrBehind{#3}{=}[\tmpargggggbattery]%
		\pictobattery[#1]<#2>{\tmpargggggbattery}%
	}{}%
	\IfSubStr{#3}{skills}{%
		\StrBehind{#3}{=}[\tmpargggggskills]%
		\pictoskills[#1]<#2>{\tmpargggggskills}%
	}{}%
	\IfSubStr{#3}{pill}{%
		\StrBehind{#3}{=}[\tmpargggggpill]%
		\pictopill[#1]<#2>{\tmpargggggpill}%
	}{}%
	\IfSubStr{#3}{traffic}{%
		\IfSubStr{#3}{=}%
			{%
				\StrBehind{#3}{=}[\tmpargggggtraffic]%
				\pictotraffic[#1]<#2>{\tmpargggggtraffic}%
			}%
			{%
				\pictotraffic[#1]<#2>{}%
			}%
	}{}%
	\IfSubStr{#3}{calendar}{%
		\StrBehind{#3}{=}[\tmpargggggcal]%
		\pictocalendar[#1]<#2>{\tmpargggggcal}%
	}{}%
	\IfSubStr{#3}{clippy}{%
		\StrBehind{#3}{=}[\tmpargggggclippy]%
		\pictoclippy[#1,style=\tmpargggggclippy]<#2>%
	}{}%
	\IfSubStr{#3}{dball}{%
		\StrBehind{#3}{=}[\tmpargggggdball]%
		\pictodball[#1]<#2>{\tmpargggggdball}%
	}{}%
}

%====DIFFICULTY LEVELS
\newlength\difficultylevelsoffset

\setKVdefault[difficultylevels]{opacity=0.4,hoffset=0.05em,swap=false,size={}}
\defKV[difficultylevels]{hoffset=\setlength\difficultylevelsoffset{#1},opacity=\def\difficultylevelsopacity{#1},size=\def\difficultylevelssize{#1}}

\NewDocumentCommand\difficultylevels{ O{} m m }{%normal version
	%#1 = keys
	%#2 = symbol
	%#3 = levels
	\restoreKV[difficultylevels]%
	\setKV[difficultylevels]{#1}%
	\IfSubStr{#3}{/}{\StrCut{#3}{/}{\tmpdifflevelsnb}{\tmpdifflevelstot}}{\def\tmpdifflevelsnb{#3}\def\tmpdifflevelstot{4}}%
	{\difficultylevelssize%
	\ifboolKV[difficultylevels]{swap}%
		{%
			\xintifboolexpr{\tmpdifflevelsnb != \tmpdifflevelstot}%
			{%mix of
				\xintFor* ##1 in {\xintSeq{1}{\tmpdifflevelstot-\tmpdifflevelsnb}}\do{%
					#2\hspace*{\difficultylevelsoffset}%
				}%
			}{}%
			\xintFor* ##1 in {\xintSeq{1}{\tmpdifflevelsnb}}\do{%
				\xintifForLast{{\tikz[baseline=(ZZZ.base)] \node[opacity=\difficultylevelsopacity,inner sep=0pt] (ZZZ) {#2} ;}\relax}{{\tikz[baseline=(ZZZ.base)] \node[opacity=\difficultylevelsopacity,inner sep=0pt] (ZZZ) {#2} ;}\hspace*{\difficultylevelsoffset}}%
			}%
		}%
		{%
			\xintifboolexpr{\tmpdifflevelsnb != \tmpdifflevelstot}%
			{%mix of
				\xintFor* ##1 in {\xintSeq{1}{\tmpdifflevelstot-\tmpdifflevelsnb}}\do{%
					{\tikz[baseline=(ZZZ.base)] \node[opacity=\difficultylevelsopacity,inner sep=0pt] (ZZZ) {#2} ;}%
					\hspace*{\difficultylevelsoffset}%
				}%
			}{}%
			\xintFor* ##1 in {\xintSeq{1}{\tmpdifflevelsnb}}\do{%
				\xintifForLast{#2\relax}{#2\hspace*{\difficultylevelsoffset}}%
			}%
		}%
	}%
}

\NewDocumentCommand\twdifficultylevels{ O{} m m }{%special version with twemoji
	\difficultylevels[#1]{\texttwemoji{#2}}{#3}%
}

%====RADARDBALLS
\defKV[pictoradardball]{height=\def\pictoradardballheight{#1},strut=\def\pictoradardballstrut{#1},dstrut=\def\pictoradardballdstrut{#1},bgcolor=\colorlet{mainradardball}{#1},markcolor=\colorlet{mainradardballmark}{#1},ballcolor=\colorlet{mainradardballmarkball}{#1}}
\setKVdefault[pictoradardball]{height=dauto,dstrut=\sampledstrutletters,strut=\samplestrutletters,bw=false}

\colorlet{mainradardball}{green!75!black}
\colorlet{mainradardballmark}{red!90!black}
\colorlet{mainradardballmarkball}{yellow!75!orange}

\newlength\dragonbradar@total@height
\newlength\dragonbradar@depth

\NewDocumentCommand\pictoradardball{ O{} D<>{} m }{%
	%3=list of balls
	\restoreKV[pictoradardball]%
	\setKV[pictoradardball]{#1}%
	\ifboolKV[pictoradardball]{bw}%
		{%
			\colorlet{mainradardball}{white}%
			\colorlet{mainradardballmark}{darkgray}%
			\colorlet{mainradardballmarkball}{gray}%
		}{}%
	\IfStrEqCase{\pictoradardballheight}{%
		{dauto}%
		{%
			\settototalheight\dragonbradar@total@height{\hbox{\pictoradardballdstrut}}%
			\settodepth\dragonbradar@depth{\hbox{\pictoradardballdstrut}}%
			\begin{tikzpicture}[baseline=-0.4\dragonbradar@total@height+\dragonbradar@depth,x=\dragonbradar@total@height,y=\dragonbradar@total@height,line join=round,scale=0.9852,#2]
		}%
		{auto}%
		{%
			\settototalheight\dragonbradar@total@height{\hbox{\pictoradardballstrut}}%
			\settodepth\dragonbradar@depth{\hbox{\pictoradardballstrut}}%
			\begin{tikzpicture}[baseline=-0.4\dragonbradar@total@height+\dragonbradar@depth,x=\dragonbradar@total@height,y=\dragonbradar@total@height,line join=round,scale=0.9852,#2]
			}%
		}[%
			\setlength\dragonbradar@total@height{\pictoradardballheight}%
			\begin{tikzpicture}[x=\dragonbradar@total@height,y=\dragonbradar@total@height,line join=round,scale=0.9852,#2]
		]%
		\draw[line width=0.015\dragonbradar@total@height,fill=lightgray!75] (70:0.4\dragonbradar@total@height)--(0.12\dragonbradar@total@height,0.45\dragonbradar@total@height) -- (-0.12\dragonbradar@total@height,0.45\dragonbradar@total@height)--(110:0.4\dragonbradar@total@height)--cycle;
		\draw[line width=0.015\dragonbradar@total@height,fill=darkgray!66] (0,0) circle[radius=0.4\dragonbradar@total@height] ;
		\begin{scope}
			\clip (0,0) circle[radius=0.4\dragonbradar@total@height] ;
			\fill[fill=lightgray!75] (-0.175\dragonbradar@total@height,0.125\dragonbradar@total@height) circle[radius=0.45\dragonbradar@total@height] ;
		\end{scope}
		\draw[line width=0.015\dragonbradar@total@height,fill=mainradardball!50!black] (0,0) circle[radius=0.3\dragonbradar@total@height] ;
		\begin{scope}%bg normal
			\clip (0,0) circle[radius=0.3\dragonbradar@total@height] ;
			\fill[fill=mainradardball] (-0.175\dragonbradar@total@height,0.125\dragonbradar@total@height) circle[radius=0.45\dragonbradar@total@height] ;
		\end{scope}
		\draw[line width=0.015\dragonbradar@total@height] (0,0) circle[radius=0.3\dragonbradar@total@height] ;
		\draw[line width=0.015\dragonbradar@total@height] (0,0) circle[radius=0.4\dragonbradar@total@height] ;
		\draw[line width=0.0075\dragonbradar@total@height] (0,0) circle[radius=0.33\dragonbradar@total@height] ;
		\begin{scope}
			\clip (0,0) circle[radius=0.3\dragonbradar@total@height] ;
			\draw[line width=0.005\dragonbradar@total@height,xstep=0.075\dragonbradar@total@height,ystep=0.075\dragonbradar@total@height] (-0.5\dragonbradar@total@height,-0.5\dragonbradar@total@height) grid (0.5\dragonbradar@total@height,0.5\dragonbradar@total@height) ;
		\end{scope}
		\draw[line width=0.015\dragonbradar@total@height,fill=lightgray!75] (0.1\dragonbradar@total@height,0.45\dragonbradar@total@height) rectangle (-0.1\dragonbradar@total@height,0.48\dragonbradar@total@height) ;
		\draw[line width=0.015\dragonbradar@total@height,fill=lightgray!75] (0,0.48\dragonbradar@total@height)--(0.12\dragonbradar@total@height,0.48\dragonbradar@total@height) arc (0:180:0.12\dragonbradar@total@height) --cycle;
		\begin{scope}[shift={(-0.033\dragonbradar@total@height,-0.0125\dragonbradar@total@height)}]
			\fill[mainradardballmark] (0,0)--(60:0.066\dragonbradar@total@height)--(0:0.066\dragonbradar@total@height)--cycle ;
		\end{scope} ;
		%shadows
		\fill[white,rotate=20] (0,0.3625\dragonbradar@total@height) circle[x radius=0.075\dragonbradar@total@height,y radius=0.0225\dragonbradar@total@height] ;
		\fill[white,rotate=105] (0,0.3625\dragonbradar@total@height) circle[x radius=0.05\dragonbradar@total@height,y radius=0.02\dragonbradar@total@height] ;
		\fill[white,rotate=8] (0,0.52\dragonbradar@total@height) circle[x radius=0.0175\dragonbradar@total@height,y radius=0.015\dragonbradar@total@height] ;
		\fill[white,rotate=13] (0,0.43\dragonbradar@total@height) circle[x radius=0.0125\dragonbradar@total@height,y radius=0.0075\dragonbradar@total@height] ;
		%mark(s)
		\if\relax\detokenize{#3}\relax%
		\else%
			\begin{scope}
				\clip (0,0) circle[radius=0.3\dragonbradar@total@height] ;
				\foreach \x/\y in {#3} {%
					\xdef\xx{\fpeval{0.075*(\x)}}%
					\xdef\yy{\fpeval{0.075*(\y)}}%
					\xintifboolexpr{ ((\xx)+0.175)^2 + ((\yy)-0.125)^2 > 0.43^2 }%
						{%
							%zone ombrée
							\fill[mainradardballmarkball!50!mainradardball!50!black] ({\xx\dragonbradar@total@height},{\yy\dragonbradar@total@height}) circle[radius=0.02\dragonbradar@total@height] ;
							\begin{scope}
								\clip (-0.175\dragonbradar@total@height,0.125\dragonbradar@total@height) circle[radius=0.45\dragonbradar@total@height] ;
								\fill[mainradardballmarkball] ({\xx\dragonbradar@total@height},{\yy\dragonbradar@total@height}) circle[radius=0.02\dragonbradar@total@height] ;
							\end{scope}
						}%
						{%
							%zone non ombrée
							\fill[mainradardballmarkball] ({\xx\dragonbradar@total@height},{\yy\dragonbradar@total@height}) circle[radius=0.02\dragonbradar@total@height] ;
						}%
				}
			\end{scope}
		\fi%
	\end{tikzpicture}%
}

%==STAMP
\def\samplesstrutstamp{qÉ}

\newsavebox\tmpmystampbox
\newlength\radius@stamp@approved
\newlength\width@text@vstretch@stamp@approved
\setlength\radius@stamp@approved{2cm}
\colorlet{stampcolor}{black}

\defKV[pictostamp]{%
	radius=\setlength\radius@stamp@approved{#1},%
	color=\colorlet{stampcolor}{#1},%
	rotate=\def\rotation@stamp@approved{#1},%
	font=\def\font@stamp@approved{#1},%
	strut=\def\strut@stamp@approved{#1}
}
\setKVdefault[pictostamp]{%
	radius=2cm,%
	color=black,%
	rotate=20,%
	font=\bfseries\sffamily,%
	starsfilled=false,%
	strut=\samplesstrutstamp,%
	alt=false
}

\tikzstyle{stampstars}=[star,star points=5,star point ratio=2.25]%

\newcommand\intstampstar[4][0]{%1 = rotate, %2=pos, %3 = big radius, %4 = small radius
	\begin{scope}[shift={#2},rotate=#1]
		\draw[stamp stars] 
		(0:#3\radius@stamp@approved) -- 
		(36:#4\radius@stamp@approved) -- 
		(72:#3\radius@stamp@approved) -- 
		(108:#4\radius@stamp@approved) -- 
		(144:#3\radius@stamp@approved) -- 
		(180:#4\radius@stamp@approved) -- 
		(216:#3\radius@stamp@approved) -- 
		(252:#4\radius@stamp@approved) -- 
		(288:#3\radius@stamp@approved) -- 
		(324:#4\radius@stamp@approved) -- 
		cycle;
	\end{scope}
}

\newcommand\inttamponapprouve{%
	\tikzset{stamp line thick/.style={line width=0.05\radius@stamp@approved}}
	\tikzset{stamp rounded thick/.style={rounded corners=0.15\radius@stamp@approved}}
	\tikzset{stamp line thin/.style={line width=0.02\radius@stamp@approved}}
	\tikzset{stamp rounded thin/.style={rounded corners=0.1\radius@stamp@approved}}
	\ifboolKV[pictostamp]{starsfilled}%
		{%
			\tikzset{stamp stars/.style={stampstars,rounded corners=0.02\radius@stamp@approved,line width=0.02\radius@stamp@approved,fill,fill opacity=0.667}}
		}%
		{%
			\tikzset{stamp stars/.style={stampstars,rounded corners=0.02\radius@stamp@approved,line width=0.02\radius@stamp@approved}}
		}%
	%big border
	\draw[stamp line thick] (25:0.975\radius@stamp@approved) arc(25:155:0.975\radius@stamp@approved) ;
	\draw[stamp line thick] (-25:0.975\radius@stamp@approved) arc(-25:-155:0.975\radius@stamp@approved) ;
	%small border
	\draw[stamp line thin] (27:0.875\radius@stamp@approved) arc(27:153:0.875\radius@stamp@approved) ;
	\draw[stamp line thin] (-27:0.875\radius@stamp@approved) arc(-27:-153:0.875\radius@stamp@approved) ;
	%big rectangle
	\draw[stamp line thick,stamp rounded thick] (0.95\radius@stamp@approved,-0.3\radius@stamp@approved) -| (1.2\radius@stamp@approved,0.3\radius@stamp@approved) -| (-1.2\radius@stamp@approved,-0.3\radius@stamp@approved) -- (0.66\radius@stamp@approved,-0.3\radius@stamp@approved);
	\draw[stamp line thick] (0.75\radius@stamp@approved,-0.3\radius@stamp@approved)--++(0.075\radius@stamp@approved,0) ;
	%small rectangle
	\ifboolKV[pictostamp]{alt}%
		{%
			\draw[stamp line thin,stamp rounded thin,fill,fill opacity=0.9] (1.125\radius@stamp@approved,0.225\radius@stamp@approved) rectangle (-1.125\radius@stamp@approved,-0.225\radius@stamp@approved) ;
			\tikzset{stamp txt/.style={text=white}}%
		}%
		{%
			\draw[stamp line thin,stamp rounded thin] (1.125\radius@stamp@approved,0.225\radius@stamp@approved) rectangle (-1.125\radius@stamp@approved,-0.225\radius@stamp@approved) ;
			\tikzset{stamp txt/.style={}}%
		}%
	%up stars
	\intstampstar[18]{(0,0.6\radius@stamp@approved)}{0.15}{0.06}
	\intstampstar[18]{(0.2\radius@stamp@approved,0.575\radius@stamp@approved)}{0.12}{0.05}
	\intstampstar[18]{(-0.2\radius@stamp@approved,0.575\radius@stamp@approved)}{0.12}{0.05}
	%down stars
	\intstampstar[54]{(0,-0.6\radius@stamp@approved)}{0.15}{0.06}
	\intstampstar[54]{(0.2\radius@stamp@approved,-0.575\radius@stamp@approved)}{0.12}{0.05}
	\intstampstar[54]{(-0.2\radius@stamp@approved,-0.575\radius@stamp@approved)}{0.12}{0.05}
	%text, max width =  1.95\radius@stamp@approved / max height = 0.375\radius@stamp@approved
	\begin{scope}
		\clip (1.125\radius@stamp@approved,0.225\radius@stamp@approved) rectangle (-1.125\radius@stamp@approved,-0.225\radius@stamp@approved) ;
		\ifthenelse{\width@text@vstretch@stamp@approved < \dimexpr2.05\radius@stamp@approved\relax}%
		{%
			\draw (0,0) node[inner sep=0pt,stamp txt] {\resizebox*{!}{0.375\radius@stamp@approved}{\font@stamp@approved\vphantom{\strut@stamp@approved}\texte@stamp@approved}} ;
		}%
		{%
			\draw (0,0) node[inner sep=0pt,stamp txt] {\resizebox*{2.05\radius@stamp@approved}{!}{\font@stamp@approved\vphantom{\strut@stamp@approved}\texte@stamp@approved}} ;
		}%
	\end{scope}
}

\NewDocumentCommand\pictostamp{ s O{} D<>{} m }{%
	\restoreKV[pictostamp]%
	\setKV[pictostamp]{#2}%
	\if\relax\detokenize{#4}\relax%
		\def\texte@stamp@approved{APPROVED}%
	\else%
		\def\texte@stamp@approved{#4}%
	\fi%
	%scaling work
	\savebox{\tmpmystampbox}{\resizebox*{!}{0.375\radius@stamp@approved}{\font@stamp@approved\vphantom{\strut@stamp@approved}\texte@stamp@approved}}%
	\settowidth\width@text@vstretch@stamp@approved{\usebox{\tmpmystampbox}}%
	%normal or absolute position
	\IfBooleanTF{#1}%
		{%
			\begin{tikzpicture}[line cap=round,overlay,remember picture,shift={#3},stampcolor,rotate=\rotation@stamp@approved,transform shape]%
				\inttamponapprouve
			\end{tikzpicture}%
		}%
		{%
			\begin{tikzpicture}[line cap=round,#3,stampcolor,rotate=\rotation@stamp@approved,transform shape]%
				\inttamponapprouve
			\end{tikzpicture}%
		}%
}

%====TIKZSHIELD (inspired by tikz-shields
\definecolor{inlinebadge-right}{HTML}{1283c4}
\definecolor{inlinebadge-right-text}{HTML}{ffffff}
\definecolor{inlinebadge-left}{HTML}{5e5e5e}
\definecolor{inlinebadge-left-text}{HTML}{ffffff}

\colorlet{inlinebadgeright}{inlinebadge-right}
\colorlet{inlinebadgerighttext}{inlinebadge-right-text}
\colorlet{inlinebadgeleft}{inlinebadge-left}
\colorlet{inlinebadgelefttext}{inlinebadge-left-text}

\def\inlinebadgefont{\small\sffamily}

\tcbset{tcbinlinebadgeleft/.style={nobeforeafter,enhanced,box align=base,sharp corners=east,arc=2pt,bicolor,boxrule=0pt,boxsep=1.75pt,top=0pt,left=0pt,right=0pt, bottom=-0.05ex,fontupper=\inlinebadgefont,interior style={top color=inlinebadgeleft,bottom color=inlinebadgeleft!60!black}}}

\tcbset{tcbinlinebadgeright/.style={nobeforeafter,enhanced,box align=base,sharp corners=west,arc=2pt,bicolor,boxrule=0pt,boxsep=1.75pt,top=0pt,left=0pt,right=0pt, bottom=-0.05ex,fontupper=\inlinebadgefont,interior style={top color=inlinebadgeright,bottom color=inlinebadgeright!60!black}}}

\NewDocumentCommand\iconscaled{O{0.85}m}{\scalebox{#1}[#1]{#2}}

\NewDocumentCommand\intdropshadowtextleft{m}{%
	\begin{tikzpicture}[baseline=(TESTL.base),outer sep=0pt, inner sep=0pt]
		\node[inlinebadge-left-text!40!black] at (0,-0.05ex) {#1};
		\node[inlinebadge-left-text] (TESTL) at (0,0) {#1};
	\end{tikzpicture}%
}

\NewDocumentCommand\intdropshadowtextright{m}{%
	\begin{tikzpicture}[baseline=(TESTR.base),outer sep=0pt, inner sep=0pt]
		\node[inlinebadge-right-text!40!black] at (0,-0.05ex) {#1};
		\node[inlinebadge-right-text] (TESTR) at (0,0) {#1};
	\end{tikzpicture}%
}

\newtcbox\intleftpart{tcbinlinebadgeleft}
\newtcbox\intrightpart{tcbinlinebadgeright}

\defKV[inlinetikzbadge]{%
	leftcolor=\colorlet{inlinebadgeleft}{#1},%
	rightcolor=\colorlet{inlinebadgeright}{#1},%
	lefttextcolor=\colorlet{inlinebadgelefttext}{#1},%
	righttextcolor=\colorlet{inlinebadgerighttext}{#1},%
	font=\def\inlinebadgefont{#1},%
	link=\def\inlinebadgelink{#1},%
}

\setKVdefault[inlinetikzbadge]{%
	leftcolor=inlinebadge-left,
	rightcolor=inlinebadge-right,
	lefttextcolor=inlinebadge-left-text,
	righttextcolor=inlinebadge-left-text,
	font=\small\sffamily,%
	link={}
}

\NewDocumentCommand\tikzinlinebadge{O{}mm}{%
	\restoreKV[inlinetikzbadge]%
	\setKV[inlinetikzbadge]{#1}%
	\IfEq{\inlinebadgelink}{}%
		{%
			\mbox{\intleftpart{\intdropshadowtextleft{\vphantom{#3}#2}}\intrightpart{\intdropshadowtextright{\vphantom{#2}#3}}}%
		}%
		{%
			{\mbox{\intleftpart{\href{\inlinebadgelink}{\intdropshadowtextleft{\vphantom{#3}#2}}}\intrightpart{\href{\inlinebadgelink}{\intdropshadowtextright{\vphantom{#2}#3}}}}}%
		}%
}

%====SMALLSTAMP
\usetikzlibrary{decorations,decorations.text}
\newlength\mylensmallstamp
\setlength\mylensmallstamp{2cm}
\newlength\mylensmallstampxinnerseptop
\newlength\mylensmallstampxinnersepbottom
\newlength\mylensmallstamptxtheight
\newlength\mylensmallstamplogoheight
\newlength\mylensmallstampbottomtxtheight
\newlength\mylensmallstamptoptxtheight
\newlength\mylensmallstamptxtlogoheight

\defKV[tkzsmallstamp]{%
	height=\setlength\mylensmallstamp{#1},%
	maincolor=\def\mycolorsmallstamp{#1},%
	toptxtcolor=\def\mytoptxtcolorsmallstamp{#1},%
	bottomtxtcolor=\def\mybottomtxtcolorsmallstamp{#1},%
	logocolor=\def\mylogotcolorsmallstamp{#1},%
	rotate=\def\myrotatesmallstamp{#1},%
	toptxtfont=\def\myfontsmallstamptop{#1},%
	bottomtxtfont=\def\myfontsmallstampbottom{#1},%
	logoscale=\def\mylogoscalesmallstamp{#1},%
	color=\def\myglobalcolorsmallstamp{#1}
}

\setKVdefault[tkzsmallstamp]{%
	height=2cm,%
	maincolor={black},%
	toptxtcolor={black},%
	bottomtxtcolor={black},%
	logocolor={black},
	inner circle=false,%
	rotate=35,%
	toptxtfont={\bfseries},%
	bottomtxtfont={\bfseries},
	reverse bottom=true,%
	image=false,%
	logoscale=1,%
	fill inner=false,%
	color={}
}

\tikzset{smallstamp/.style={line width=0.0125\mylensmallstamp}}
\tikzset{smallstampinner/.style={line width=0.005\mylensmallstamp}}

\NewDocumentCommand\pictosmallstamp{sO{}D<>{}mmm}{%
	\restoreKV[tkzsmallstamp]%
	\setKV[tkzsmallstamp]{#2}%
	\setlength\mylensmallstamptxtheight{0.125\mylensmallstamp}%
	\setlength\mylensmallstamplogoheight{\fpeval{\mylogoscalesmallstamp*0.4}\mylensmallstamp}%
	\settoheight\mylensmallstamptoptxtheight{\hbox{\myfontsmallstamptop#4}}%TOP
	\settoheight\mylensmallstampbottomtxtheight{\hbox{\myfontsmallstampbottom#5}}%BOTTOM
	%----logo
	\ifboolKV[tkzsmallstamp]{image}%
		{}%
		{%
			\settototalheight\mylensmallstamptxtlogoheight{\hbox{#6}}%LOGO
			\xdef\mytmpscalesmallstamplogo{\fpeval{\mylensmallstamplogoheight/\mylensmallstamptxtlogoheight}}%LOGO
		}%
	%----end logo
	\xdef\mytmpscalesmallstamptoptext{\fpeval{\mylensmallstamptxtheight/\mylensmallstamptoptxtheight}}%TOP
	\xdef\mytmpinvscalesmallstamptoptext{\fpeval{1/\mytmpscalesmallstamptoptext}}%
	\xdef\mytmpscalesmallstampbottomtext{\fpeval{\mylensmallstamptxtheight/\mylensmallstampbottomtxtheight}}%BOTTOM
	%----global color
	\ifthenelse{\equal{\myglobalcolorsmallstamp}{}}%
		{}%
		{%
			\def\mycolorsmallstamp{\myglobalcolorsmallstamp}%
			\def\mytoptxtcolorsmallstamp{\myglobalcolorsmallstamp}%
			\def\mybottomtxtcolorsmallstamp{\myglobalcolorsmallstamp}%
			\def\mylogotcolorsmallstamp{\myglobalcolorsmallstamp}%
		}%
	%----global color end
	\IfBooleanTF{#1}%
		{%
			\begin{tikzpicture}[overlay,remember picture,shift={#3},transform shape]
		}%
		{%
			\begin{tikzpicture}[transform shape,#3]
		}%
		\draw[\mycolorsmallstamp,smallstamp] (0,0) circle[radius=0.5\mylensmallstamp] ;
		\useasboundingbox (0,0) circle[radius=0.5\mylensmallstamp] ;
		\begin{scope}[rotate=\myrotatesmallstamp]
			\clip (0,0) circle[radius=0.5\mylensmallstamp] ;
			\ifboolKV[tkzsmallstamp]{inner circle}%
				{%
					\ifboolKV[tkzsmallstamp]{fill inner}%
						{%
							\fill[\mycolorsmallstamp!10,smallstampinner] (0,0) circle[radius=0.3\mylensmallstamp] ;%
						}%
						{%
							\draw[\mycolorsmallstamp!50,fill=\mycolorsmallstamp!10,smallstampinner] (0,0) circle[radius=0.3\mylensmallstamp] ;%
						}%
				}%
				{%
					\ifboolKV[tkzsmallstamp]{fill inner}%
						{%
							\fill[draw=none,\mycolorsmallstamp!10,smallstampinner] (0,0) circle[radius=0.3\mylensmallstamp] ;%
						}%
						{}%
				}%
			%top text
			\draw [draw=none,postaction={decorate},decoration={raise=0.0375\mylensmallstamp,text effects along path,text align=center,reverse path,text={#4},text effects/.cd,characters={scale=\mytmpscalesmallstamptoptext,font=\myfontsmallstamptop,color=\mytoptxtcolorsmallstamp}},text effects={text along path},rotate=-90] (0,0) circle[radius=0.3\mylensmallstamp] ;
			%bottom text
			\ifboolKV[tkzsmallstamp]{reverse bottom}%
				{%
					\draw [draw=none,postaction={decorate},decoration={reverse path,raise=0.0375\mylensmallstamp,text effects along path,text align=center,text={#5},text effects/.cd,characters={scale=\mytmpscalesmallstamptoptext,font=\myfontsmallstampbottom,color=\mybottomtxtcolorsmallstamp}},text effects={text along path},rotate=90] (0,0) circle[radius=0.3\mylensmallstamp] ;
				}%
				{%
					\draw [draw=none,postaction={decorate},decoration={raise=0.05\mylensmallstamp,text effects along path,text align=center,text={#5},text effects/.cd,characters={scale=\mytmpscalesmallstamptoptext,font=\myfontsmallstampbottom,color=\mybottomtxtcolorsmallstamp}},text effects={text along path},rotate=90] (0,0) circle[radius=0.5\mylensmallstamp] ;
				}%
			%middle logo
			\ifboolKV[tkzsmallstamp]{image}%
				{%
					\draw (0,0) node[anchor=center] {\includegraphics[height=\mylensmallstamplogoheight]{#6}} ;
				}%
				{%
					\clip (0,0) circle[radius=0.3\mylensmallstamp] ;
					\draw[\mylogotcolorsmallstamp] (0,0) node[scale=\mytmpscalesmallstamplogo] {#6} ;
				}%
		\end{scope}
	\end{tikzpicture}%
}

%====RINGS inspiration https://tex.stackexchange.com/posts/323693/timeline (3.0)

\newlength\tkzRingsHeight
\newlength\tkzRingsDepth
\newlength\tkzRingsFullHeight

\defKV[tkzRings]{height=\def\tkzRingsTypeHeight{#1},strut=\def\tkzRingsTypeStrut{#1},dstrut=\def\tkzRingsTypeDstrut{#1},clip bb=\def\tkzRingsClipBB{#1}}
\setKVdefault[tkzRings]{height=dauto,strut=H,dstrut=qH,clip bb=0pt,color=true}

\definecolor{tkzRings@color@blue}{RGB}{0,120,208}        % A blue
\definecolor{tkzRings@color@yellow}{RGB}{255,177,20}     % B yellow
\definecolor{tkzRings@color@black}{RGB}{0,0,0}           % C black
\definecolor{tkzRings@color@green}{RGB}{0,166,81}        % D green
\definecolor{tkzRings@color@red}{RGB}{240,40,45}         % E red

\def\tkzRingsGap(#1,#2)(#3:#4){%
	($(#1,#2) + (#3:\tkzRingsOuterWhiteRadius)$)
	arc(#3:#4:\tkzRingsOuterWhiteRadius) --
	($(#1,#2) + (#4:\tkzRingsInnerWhiteRadius)$)
	arc(#4:#3:\tkzRingsInnerWhiteRadius) --
	cycle
}

%constants
\def\tkzRingsxShift{169.5538bp}%
\def\tkzRingsyShift{-71.7013bp}%
\def\tkzRingsRadius{71.6821bp}%
\def\tkzRingsWhiteLineWidth{3.762bp}%
\def\tkzRingsColorLineWidth{12.9041bp}%
%radius
\pgfmathsetlengthmacro{\tkzRingsInnerColorRadius}{\tkzRingsRadius - \tkzRingsColorLineWidth/2}%
\pgfmathsetlengthmacro{\tkzRingsOuterColorRadius}{\tkzRingsRadius + \tkzRingsColorLineWidth/2}%
\pgfmathsetlengthmacro{\tkzRingsInnerWhiteRadius}{\tkzRingsInnerColorRadius - \tkzRingsWhiteLineWidth}%
\pgfmathsetlengthmacro{\tkzRingsOuterWhiteRadius}{\tkzRingsOuterColorRadius + \tkzRingsWhiteLineWidth}%
%centers
\def\tkzRingsxA{0pt}%
\def\tkzRingsyA{0pt}%
\pgfmathsetlengthmacro{\tkzRingsxC}{\tkzRingsxA + \tkzRingsxShift}%
\let\tkzRingsyC\tkzRingsyA%
\pgfmathsetlengthmacro{\tkzRingsxE}{\tkzRingsxC + \tkzRingsxShift}%
\let\tkzRingsyE\tkzRingsyC%
\pgfmathsetlengthmacro{\tkzRingsxB}{(\tkzRingsxA + \tkzRingsxC)/2}%
\pgfmathsetlengthmacro{\tkzRingsyB}{\tkzRingsxA + \tkzRingsyShift}%
\pgfmathsetlengthmacro{\tkzRingsxD}{(\tkzRingsxC + \tkzRingsxE)/2}%
\let\tkzRingsyD\tkzRingsyB%
%bbox
\pgfmathsetlengthmacro\tkzRingsllxBB{\tkzRingsxA - \tkzRingsOuterColorRadius}%
\pgfmathsetlengthmacro\tkzRingsllyBB{\tkzRingsyB - \tkzRingsOuterColorRadius}%
\pgfmathsetlengthmacro\tkzRingsurxBB{\tkzRingsxE + \tkzRingsOuterColorRadius}%
\pgfmathsetlengthmacro\tkzRingsuryBB{\tkzRingsyE + \tkzRingsOuterColorRadius}%
%cliiping bbox
\pgfmathsetlengthmacro\tkzRingsllxClip{\tkzRingsllxBB - \tkzRingsClipBB}%
\pgfmathsetlengthmacro\tkzRingsllyClip{\tkzRingsllyBB - \tkzRingsClipBB}%
\pgfmathsetlengthmacro\tkzRingsurxClip{\tkzRingsurxBB + \tkzRingsClipBB}%
\pgfmathsetlengthmacro\tkzRingsuryClip{\tkzRingsuryBB + \tkzRingsClipBB}%
\def\tkzRingsClipBoxArea{(\tkzRingsllxClip, \tkzRingsllyClip) rectangle (\tkzRingsurxClip, \tkzRingsuryClip)}

\newcommand\intTkzRings{%
	% upper
	\begin{scope}[even odd rule]
		\clip \tkzRingsClipBoxArea
		% yellow ring in blue ring
		\tkzRingsGap(\tkzRingsxB,\tkzRingsyB)(225:135)
		% yellow ring in black ring
		\tkzRingsGap(\tkzRingsxB, \tkzRingsyB)(90:45)
		% green ring in black ring
		\tkzRingsGap(\tkzRingsxD, \tkzRingsyD)(225:135)
		% green ring in red ring
		\tkzRingsGap(\tkzRingsxD, \tkzRingsyD)(90:45) ;
		\ifboolKV[tkzRings]{color}%
			{%
				\draw[tkzRings@color@blue] (\tkzRingsxA, \tkzRingsyA) circle;
				\draw[tkzRings@color@black] (\tkzRingsxC, \tkzRingsyC) circle;
				\draw[tkzRings@color@red] (\tkzRingsxE, \tkzRingsyE) circle;
			}%
			{%
				\draw (\tkzRingsxA, \tkzRingsyA) circle;
				\draw (\tkzRingsxC, \tkzRingsyC) circle;
				\draw (\tkzRingsxE, \tkzRingsyE) circle;
			}%
	\end{scope}
	% lower
	\begin{scope}[even odd rule]
		\clip \tkzRingsClipBoxArea
		% blue ring in yellow ring
		\tkzRingsGap(\tkzRingsxA, \tkzRingsyA)(45:-45)
		% black ring in yellow ring
		\tkzRingsGap(\tkzRingsxC, \tkzRingsyC)(225:270)
		% black ring in green ring
		\tkzRingsGap(\tkzRingsxC, \tkzRingsyC)(45:-45)
		% red ring in green ring
		\tkzRingsGap(\tkzRingsxE, \tkzRingsyE)(225:270) ;
		\ifboolKV[tkzRings]{color}%
			{%
				\draw[tkzRings@color@yellow] (\tkzRingsxB, \tkzRingsyB) circle;
				\draw[tkzRings@color@green] (\tkzRingsxD, \tkzRingsyD) circle;
			}%
			{%
				\draw (\tkzRingsxB, \tkzRingsyB) circle;
				\draw (\tkzRingsxD, \tkzRingsyD) circle;
			}%
	\end{scope}
	\useasboundingbox (\tkzRingsllxBB, \tkzRingsllyBB) rectangle (\tkzRingsurxBB, \tkzRingsuryBB);
}
\NewDocumentCommand\tkzRings{O{}m}{%
	\restoreKV[tkzRings]%
	\setKV[tkzRings]{#1}%
	%scale
	\IfSubStr{\tkzRingsTypeHeight}{auto}%
		{%
			\IfSubStr{\tkzRingsTypeHeight}{d}%
				{%
					\settototalheight\tkzRingsHeight{\hbox{\tkzRingsTypeDstrut}}%
					\settodepth\tkzRingsDepth{\hbox{\tkzRingsTypeDstrut}}%
					\pgfmathsetlengthmacro{\tkzRingsFullHeight}{(\tkzRingsyA+\tkzRingsRadius)-(\tkzRingsyB-\tkzRingsRadius)}%
					\xdef\tkzRingsScale{\fpeval{\tkzRingsHeight/(\tkzRingsFullHeight+\tkzRingsColorLineWidth)}}%
					\settodepth\tkzRingsDepth{\hbox{\tkzRingsTypeDstrut}}%
					\raisebox{-\tkzRingsDepth}{%
						\begin{tikzpicture}[scale=\tkzRingsScale,line width=\fpeval{\tkzRingsScale*\tkzRingsColorLineWidth},radius=\tkzRingsRadius,#2]
							\intTkzRings
						\end{tikzpicture}%
					}%
				}%
				{%
					\settototalheight\tkzRingsHeight{\hbox{\tkzRingsTypeStrut}}%
					\pgfmathsetlengthmacro{\tkzRingsFullHeight}{(\tkzRingsyA+\tkzRingsRadius)-(\tkzRingsyB-\tkzRingsRadius)}%
					\xdef\tkzRingsScale{\fpeval{\tkzRingsHeight/(\tkzRingsFullHeight+\tkzRingsColorLineWidth)}}%
					\begin{tikzpicture}[scale=\tkzRingsScale,line width=\fpeval{\tkzRingsScale*\tkzRingsColorLineWidth},radius=\tkzRingsRadius,#2]
						\intTkzRings
					\end{tikzpicture}%
				}%
		}%
		{%
			%scale
			\setlength\tkzRingsHeight{\tkzRingsTypeHeight}%
			\pgfmathsetlengthmacro{\tkzRingsFullHeight}{(\tkzRingsyA+\tkzRingsRadius)-(\tkzRingsyB-\tkzRingsRadius)}%
			\xdef\tkzRingsScale{\fpeval{\tkzRingsHeight/(\tkzRingsFullHeight+\tkzRingsColorLineWidth)}}%
			%tikzpicture
			\begin{tikzpicture}[scale=\tkzRingsScale,line width=\fpeval{\tkzRingsScale*\tkzRingsColorLineWidth},radius=\tkzRingsRadius,#2]
				\intTkzRings
			\end{tikzpicture}%
		}%
}

%====RUBIK's CUBE
\RequirePackage{tikz-3dplot}
\usetikzlibrary{3d}

\setKVdefault[tikzrubik]{height=auto,width=auto,radius=0.1,strut={qM},empty color={},rescale=1}
\defKV[tikzrubik]{height=\def\tikzrubikmyheight{#1},width=\def\tikzrubikmywidth{#1},radius=\pgfmathsetmacro\tikzrubikradius{#1},strut=\def\tikzrubikstrut{#1},empty color=\def\tikzrubikfillempty{#1},rescale=\def\tikzrubikmycustomscale{#1}}

%====colors
\definecolor{rcB}{HTML}{0000FF}
\definecolor{rcW}{HTML}{FFFFFF}
\definecolor{rcY}{HTML}{FFFF00}
\definecolor{rcG}{HTML}{008000}
\definecolor{rcO}{HTML}{FFA500}
\definecolor{rcR}{HTML}{FF0000}
%list of colors (array)
\def\myrubcolors{{"rcW","rcY","rcY","rcR","rcW","rcB","rcW","rcO","rcB","rcG","rcR","rcG","rcR","rcO","rcG","rcY","rcG","rcW","rcB","rcO","rcB","rcG","rcG","rcW","rcO","rcW","rcR"}}
%====dim
\newlength\tikrcfixedheight
\newlength\tikrcfixedwidth
\setlength\tikrcfixedheight{4.46cm}
\setlength\tikrcfixedwidth{4.15cm}
\newlength\tikrcusedheight
\newlength\tikrcusedwidth
\newlength\tikrcuseddepth

\newcommand\inttkzrubic{%
	\begin{tikzpicture}[scale=\tikrcscale,line width=\fpeval{\tikrcscale*0.4}mm,transform shape]
%		\draw[lightgray,xstep=0.1,ystep=0.1] (-2.2,-2.3) grid (2.2,2.3) ;
%		\draw[gray] (-2.2,-2.3) grid (2.2,2.3) ;
		%\tdplotsetmaincoords{55}{150}%
		\tdplotsetmaincoords{65}{120}%
		\begin{scope}[tdplot_main_coords,line join=round,fill=\tikzrubikfillempty]
			\foreach \X in {-1.5,-0.5,0.5}{
				\foreach \Y in {-1.5,-0.5,0.5}{
					%faces1/2/3 (hidden)
					\draw [canvas is yz plane at x=-1.5,shift={(\X,\Y)}] (0.5,0) -- ({1-\tikzrubikradius},0) arc (-90:0:\tikzrubikradius) -- (1,{1-\tikzrubikradius}) arc (0:90:\tikzrubikradius) -- (\tikzrubikradius,1) arc (90:180:\tikzrubikradius) -- (0,\tikzrubikradius) arc (180:270:\tikzrubikradius) -- cycle;
					\draw [canvas is xz plane at y=-1.5,shift={(\X,\Y)}] (0.5,0) -- ({1-\tikzrubikradius},0) arc (-90:0:\tikzrubikradius) -- (1,{1-\tikzrubikradius}) arc (0:90:\tikzrubikradius) -- (\tikzrubikradius,1) arc (90:180:\tikzrubikradius) -- (0,\tikzrubikradius) arc (180:270:\tikzrubikradius) -- cycle;
					\draw [canvas is yx plane at z=-1.5,shift={(\X,\Y)}] (0.5,0) -- ({1-\tikzrubikradius},0) arc (-90:0:\tikzrubikradius) -- (1,{1-\tikzrubikradius}) arc (0:90:\tikzrubikradius) -- (\tikzrubikradius,1) arc (90:180:\tikzrubikradius) -- (0,\tikzrubikradius) arc (180:270:\tikzrubikradius) -- cycle;
				}
			}
		\end{scope}
		\begin{scope}[tdplot_main_coords,line join=round]
			\foreach \X [count=\nX starting from 0] in {-1.5,-0.5,0.5}{
				\foreach \Y [count=\nY starting from 0] in {-1.5,-0.5,0.5}{
					%faces4/5/6 (view)
					\pgfmathtruncatemacro{\numposcol}{\nX+3*(2-\nY)}
					\pgfmathsetmacro{\myrccolor}{\myrubcolors[\numposcol]}
					\draw [canvas is yz plane at x=1.5,shift={(\X,\Y)},fill=\myrccolor] (0.5,0) -- ({1-\tikzrubikradius},0) arc (-90:0:\tikzrubikradius) -- (1,{1-\tikzrubikradius}) arc (0:90:\tikzrubikradius) -- (\tikzrubikradius,1) arc (90:180:\tikzrubikradius) -- (0,\tikzrubikradius) arc (180:270:\tikzrubikradius) -- cycle;
					\pgfmathtruncatemacro{\numposcol}{2-\nX+3*(2-\nY)+9}
					\pgfmathsetmacro{\myrccolor}{\myrubcolors[\numposcol]}
					\draw [canvas is xz plane at y=1.5,shift={(\X,\Y)},fill=\myrccolor] (0.5,0) -- ({1-\tikzrubikradius},0) arc (-90:0:\tikzrubikradius) -- (1,{1-\tikzrubikradius}) arc (0:90:\tikzrubikradius) -- (\tikzrubikradius,1) arc (90:180:\tikzrubikradius) -- (0,\tikzrubikradius) arc (180:270:\tikzrubikradius) -- cycle;
					\pgfmathtruncatemacro{\numposcol}{2-\nY+3*\nX+18}
					\pgfmathsetmacro{\myrccolor}{\myrubcolors[\numposcol]}
					\draw [canvas is yx plane at z=1.5,shift={(\X,\Y)},fill=\myrccolor] (0.5,0) -- ({1-\tikzrubikradius},0) arc (-90:0:\tikzrubikradius) -- (1,{1-\tikzrubikradius}) arc (0:90:\tikzrubikradius) -- (\tikzrubikradius,1) arc (90:180:\tikzrubikradius) -- (0,\tikzrubikradius) arc (180:270:\tikzrubikradius) -- cycle;
				}
			}
		\end{scope}
	\end{tikzpicture}%
}

\NewDocumentCommand\tkzPuzzleCube{ !O{} }{%
	\restoreKV[tikzrubik]%
	\setKV[tikzrubik]{#1}%
	\ifthenelse{\equal{\tikzrubikmyheight}{auto}}%
		{%
			\ifthenelse{\equal{\tikzrubikmywidth}{auto}}%
				{%full auto (inline ?)
					\settototalheight\tikrcusedheight{\hbox{\tikzrubikstrut}}%
					\settodepth\tikrcuseddepth{\hbox{\tikzrubikstrut}}%
					\xdef\tikrcscale{\fpeval{\tikzrubikmycustomscale*\tikrcusedheight/\tikrcfixedheight}}%
					\raisebox{\dimexpr-\tikrcuseddepth+0.5\tikrcusedheight-\fpeval{0.5*\tikzrubikmycustomscale}\tikrcusedheight\relax}{\inttkzrubic}%
				}%
				{%width given
					\setlength\tikrcusedwidth{\tikzrubikmywidth}%
					\xdef\tikrcscale{\fpeval{\tikrcusedwidth/\tikrcfixedwidth}}%
					\inttkzrubic
				}%
		}%
		{%
			\ifthenelse{\equal{\tikzrubikmywidth}{auto}}%
				{%height given
					\setlength\tikrcusedheight{\tikzrubikmyheight}%
					\xdef\tikrcscale{\fpeval{\tikrcusedheight/\tikrcfixedheight}}%
					\inttkzrubic
				}%
				{}%
		}%
}

\endinput