% 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}[2026/11/09 0.20e Small pictograms, made with tikz]

%====HISTORY
% v 0.20e  mathman
% v 0.20d  LLS levels
% v 0.20c  Excalamation + Bugfixes
% v 0.20b  Donut + PoolBall
% v 0.20a  3dim deco + kawaiihamster + spidercab
% v 0.1.9  Hair gk
% v 0.1.8  Simple ProgressBar
% 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]{%
  rescale=\def\tkzLevelStarsRecale{#1},%
  colors=\def\tkzLevelStarsColors{#1},%
  offset=\setlength{\pictotmpoffsetetoiles}{#1},%
  height=\def\pictotmpheightetetoiles{#1},%
  strut=\def\pictotmpstrutetetoiles{#1},%
  dstrut=\def\pictotmpdstrutetetoiles{#1}
}

\setKVdefault[pictostars]{%
  rescale=0.975,%
  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}{\tkzLevelStarsRecale\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}{\tkzLevelStarsRecale\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}%
    }%
}

\NewCommandCopy\pictorings\tkzRings

%====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
        }%
        {}%
    }%
}

\NewCommandCopy\pictorubcube\tkzPuzzleCube

%====SIMPLE PROGRESS BAR
\newlength\widthprogressbartikz
\newlength\depthprogressbartikz
\newlength\heightprogressbartikz

\colorlet{colorprogressbartikz}{gray}
\colorlet{colorprogressbarbordertikz}{black}

\tikzset{progressbartikzshade/.style={shading=axis,right color=colorprogressbartikz,left color=colorprogressbartikz!50!white}}

\newcommand\intprogressbartikz[1]{%
  \begin{tikzpicture}[x={\widthprogressbartikz},y={\heightprogressbartikz},line width={\fpeval{0.0375*\heightprogressbartikz}pt},scale=\fpeval{1/(1+0.0375)}]
    \ifboolKV[progressbartikz]{shade}
      {%
        \fill[progressbartikzshade] (0,0) rectangle ({#1},1);
      }%
      {%
        \fill[colorprogressbartikz] (0,0) rectangle ({#1},1);
      }%
    \draw[colorprogressbarbordertikz] (0,0) rectangle (1,1);
  \end{tikzpicture}%
}

\defKV[progressbartikz]{%
  width=\setlength\widthprogressbartikz{#1},%
  height=\def\typeheightprogressbartikz{#1},%
  fill color=\colorlet{colorprogressbartikz}{#1},%
  border color=\colorlet{colorprogressbarbordertikz}{#1},%
  strut=\def\strutprogressbartikz{#1},%
  dstrut=\def\dstrutprogressbartikz{#1}
}

\setKVdefault[progressbartikz]{%
  width=1.25in,%
  height=dauto,%
  fill color=gray,%
  border color=black,%
  shade=true,%
  strut={M},%
  dstrut={qM}
}

\NewDocumentCommand{\tkzProgressbar}{ O{} m }{%
  \restoreKV[progressbartikz]%
  \setKV[progressbartikz]{#1}%
  \xdef\tmpargpbtikz{\fpeval{min(max(#2,0),1)}}%
  \ifthenelse{\equal{\typeheightprogressbartikz}{dauto}}%
    {%
      \settototalheight\heightprogressbartikz{\hbox{\dstrutprogressbartikz}}%
      \settodepth\depthprogressbartikz{\hbox{\dstrutprogressbartikz}}%
      \raisebox{-\depthprogressbartikz}%
        {%
          \intprogressbartikz{\tmpargpbtikz}%
        }%
    }%
    {%
      \ifthenelse{\equal{\typeheightprogressbartikz}{auto}}%
        {%height given
          \settoheight\heightprogressbartikz{\hbox{\strutprogressbartikz}}%
        }%
        {%
          \setlength\heightprogressbartikz{\typeheightprogressbartikz}%
        }%
      \intprogressbartikz{\tmpargpbtikz}%
    }%
}

\NewCommandCopy\pictoprogressbar\tkzProgressbar

%====kakarot Hair
\newlength\tkzhairgkheight
\newlength\tkzhairgkfullheight
\newlength\tkzhairgkdepth
\setlength\tkzhairgkfullheight{8cm}

\newcommand\inttkzhairgk[2][]{%
  \begin{tikzpicture}[scale=#2,#1,transform shape,]
    \path[draw=none,fill] (10.0, -7.9).. controls (10.0, -7.9) 
    and (10.9, -7.1) .. (11.7, -7.0).. controls (11.7, -7.0) and (10.8, -6.5) .. 
    (9.0, -6.9).. controls (9.0, -6.9) and (8.6, -5.5) .. (7.2, -5.5).. controls 
    (7.2, -5.5) and (6.7, -3.4) .. (5.7, -2.6).. controls (5.7, -2.6) and (6.2, 
    -3.9) .. (6.1, -4.9).. controls (6.1, -4.9) and (5.3, -3.4) .. (2.9, -3.4).. 
    controls (2.9, -3.4) and (3.7, -4.1) .. (3.9, -4.7).. controls (3.9, -4.7) and
    (3.3, -4.7) .. (2.9, -4.9).. controls (2.9, -4.9) and (4.1, -5.4) .. (4.1, 
    -6.1).. controls (4.1, -6.1) and (2.6, -5.2) .. (0.8, -6.3).. controls (0.8, 
    -6.3) and (2.6, -6.9) .. (3.5, -8.3).. controls (3.5, -8.3) and (2.2, -8.0) ..
    (1.0, -8.8).. controls (1.0, -8.8) and (3.3, -8.9) .. (4.0, -9.7).. controls 
    (4.0, -9.7) and (3.3, -10.1) .. (3.0, -10.3).. controls (3.0, -10.3) and (4.4,
    -10.2) .. (4.6, -10.5).. controls (4.6, -10.5) and (4.3, -9.6) .. (4.2, 
    -8.7).. controls (4.2, -8.7) and (4.5, -8.7) .. (4.9, -9.7).. controls (4.9, 
    -9.7) and (5.0, -8.5) .. (5.5, -8.4).. controls (5.5, -8.4) and (5.4, -9.5) ..
    (5.5, -9.7).. controls (5.5, -9.7) and (6.0, -8.5) .. (6.9, -8.0).. controls 
    (6.9, -8.0) and (7.2, -8.9) .. (7.0, -10.0).. controls (7.0, -10.0) and (7.9, 
    -9.0) .. (7.9, -8.1).. controls (7.9, -8.1) and (8.3, -8.6) .. (8.3, -9.3).. 
    controls (8.3, -9.3) and (8.8, -8.6) .. (9.2, -8.7).. controls (9.2, -8.7) and
    (9.3, -9.6) .. (8.3, -10.6).. controls (8.3, -10.6) and (9.5, -9.9) .. (10.3,
    -9.7).. controls (10.3, -9.7) and (10.1, -9.5) .. (9.7, -9.6).. controls 
    (9.7, -9.6) and (11.5, -8.5) .. (12.4, -8.2).. controls (12.4, -8.2) and 
    (11.7, -7.8) .. (10.0, -7.9) -- cycle;
  \end{tikzpicture}%
}

\NewDocumentCommand\pictogkhair{ O{} m }{%
  \ifthenelse{\equal{#2}{dauto}}%
    {%
      \settototalheight\tkzhairgkheight{\hbox{qM}}%
      \settodepth\tkzhairgkdepth{\hbox{qM}}%
      \xdef\tkzhairgkglobalscale{\fpeval{\tkzhairgkheight/\tkzhairgkfullheight}}%
      \raisebox{-\tkzhairgkdepth}{%
        \inttkzhairgk[#1]{\tkzhairgkglobalscale}%
      }%
    }%
    {%
      \ifthenelse{\equal{#2}{auto}}%
        {%
          \settoheight\tkzhairgkheight{\hbox{M}}%
          \xdef\tkzhairgkglobalscale{\fpeval{\tkzhairgkheight/\tkzhairgkfullheight}}%
        }%
        {%
          \xdef\tkzhairgkglobalscale{\fpeval{#2/\tkzhairgkfullheight}}%
        }%
      \inttkzhairgk[#1]{\tkzhairgkglobalscale}%
    }%
}

%====3dim deco (v1)
\newlength\tkzdecothreedimheight
\newlength\tkzdecothreedimdepth

\newcommand\inttkzdecothreedimA{%
  \foreach \angle in {0,90,180,270}{%
    \draw[rotate=\angle,tkzdecothreedim ext color] (1,1)--++(0,1.5)--++(0.5,0)--++(0,-1)--++(1,0)--++(0,-0.5)--cycle;
    \draw[rotate=\angle,tkzdecothreedim main color] (0,0)--(0.5,0)--(2.5,1)--(1,1)--cycle;
    \draw[rotate=\angle,tkzdecothreedim shadow color] (0,0)--(0,0.5)--(1,2.5)--(1,1)--cycle;
  }
}

\def\inttikztridimbigradius{3.6}
\def\inttikztridimsmallradius{3.2}
\newcommand\inttkzdecothreedimB{%
  %border
  \filldraw[tkzdecothreedim shadow alt color] (25:\inttikztridimbigradius)--(90:\inttikztridimsmallradius)--(155:\inttikztridimbigradius)--(155:{2/3*\inttikztridimbigradius})--(90:{2/3*\inttikztridimsmallradius})--(25:{2/3*\inttikztridimbigradius})--cycle ;
  \filldraw[tkzdecothreedim shadow color] (155:{2/3*\inttikztridimbigradius})--(155:\inttikztridimbigradius)--(-155:\inttikztridimbigradius)--(-90:\inttikztridimsmallradius)--(-90:{2/3*\inttikztridimsmallradius})--(-155:{2/3*\inttikztridimbigradius})--cycle ;
  \filldraw[tkzdecothreedim main color] (-90:\inttikztridimsmallradius)--(-90:{2/3*\inttikztridimsmallradius})--(-25:{2/3*\inttikztridimbigradius})--(25:{2/3*\inttikztridimbigradius})--(25:\inttikztridimbigradius)--(-25:\inttikztridimbigradius)--cycle ;
  %inner border
  \filldraw[tkzdecothreedim shadow color] (90:{1/3*\inttikztridimsmallradius})--(90:{2/3*\inttikztridimsmallradius})--(25:{2/3*\inttikztridimbigradius})--(-25:{2/3*\inttikztridimbigradius})--(-25:{1/3*\inttikztridimbigradius})--(25:{1/3*\inttikztridimbigradius})--cycle;
  \filldraw[tkzdecothreedim main color] (90:{1/3*\inttikztridimsmallradius})--(90:{2/3*\inttikztridimsmallradius})--(155:{2/3*\inttikztridimbigradius})--(-155:{2/3*\inttikztridimbigradius})--(-155:{1/3*\inttikztridimbigradius})--(155:{1/3*\inttikztridimbigradius})--cycle;
  \filldraw[tkzdecothreedim shadow alt color] (-155:{1/3*\inttikztridimsmallradius})--(-155:{2/3*\inttikztridimbigradius})--(-90:{2/3*\inttikztridimsmallradius})--(-25:{2/3*\inttikztridimbigradius})--(-25:{1/3*\inttikztridimbigradius})--(-90:{1/3*\inttikztridimsmallradius})--cycle;
  %inner
  \filldraw[tkzdecothreedim main color] (0,0)--(25:{1/3*\inttikztridimbigradius})--(-25:{1/3*\inttikztridimbigradius})--(-90:{1/3*\inttikztridimsmallradius})--cycle ;
  \filldraw[tkzdecothreedim shadow alt color] (0,0)--(25:{1/3*\inttikztridimbigradius})--(90:{1/3*\inttikztridimsmallradius})--(155:{1/3*\inttikztridimbigradius})--cycle ;
  \filldraw[tkzdecothreedim shadow color] (0,0)--(155:{1/3*\inttikztridimbigradius})--(-155:{1/3*\inttikztridimbigradius})--(-90:{1/3*\inttikztridimsmallradius})--cycle ;
}

\newcommand\inttkzdecothreedimC{%
  %shadow
  \draw[tkzdecothreedim shadow alt color] (3,3)--(9,9)--++(3,0)--(0,3)--cycle;
  \draw[tkzdecothreedim shadow alt color] (9,3)--(3,9)--++(-3,0)--(12,3)--cycle;
  \draw[tkzdecothreedim shadow alt color] (4.5,3)--(7.5,9)--++(-3,0)--(7.5,3)--cycle;
  \draw[fill=darkgray!50!black,line join=bevel] (3,4.5)--(9,7.5)--(9,4.5)--(3,7.5)--cycle;
  \draw[fill=darkgray!50!black,line join=bevel] (3,3)--(3,0)--(9,12)--(9,9)--cycle;
  \draw[fill=darkgray!50!black,line join=bevel] (9,3)--(9,0)--(3,12)--(3,9)--cycle;
  \setsepchar{,}%
  \readlist*\tkzthreedimdecolistecouls{\tkzthreedimdecocouls}%
  \foreach \i in {0,1,2}{%
    \foreach \j in {0,1,2}{%
      \xdef\k{\inteval{3*\j+\i+1}}%
      \itemtomacro\tkzthreedimdecolistecouls[\k]{\tmpmycol}%
      \draw[fill=\tmpmycol,line join=bevel] ({4.5*\i},{4.5*\j}) rectangle++ (3,3) ;
    }
  }
}

\newcommand\inttkzdecothreedimD{%
  %black part
  \begin{scope}[line join=bevel]
    \draw[fill=black] (0,3)--++(1,-1)--++(2,1)--cycle;
    \draw[fill=black] (0,3)--++(-1,-1)--++(1,-2)--cycle;
    \draw[fill=black] (-3,0)--++(1,1)--++(-1,2)--cycle;
    \draw[fill=black] (-3,0)--++(1,-1)--++(2,1)--cycle;
    \draw[fill=black] (0,-3)--++(-1,1)--++(-2,-1)--cycle;
    \draw[fill=black] (0,-3)--++(1,1)--++(-1,2)--cycle;
    \draw[fill=black] (3,0)--++(-1,1)--++(-2,-1)--cycle;
    \draw[fill=black] (3,0)--++(-1,-1)--++(1,-2)--cycle;
    %alt part
    \draw[tkzdecothreedim main color] (0,0)--++(1,2)--++(-1,1)--cycle ;
    \draw[tkzdecothreedim main color] (0,3)--++(-1,-1)--++(-2,1)--cycle ;
    \draw[tkzdecothreedim main color] (-3,0)--++(1,1)--++(2,-1)--cycle ;
    \draw[tkzdecothreedim main color] (-3,0)--++(1,-1)--++(-1,-2)--cycle ;
    \draw[tkzdecothreedim main color] (0,-3)--++(-1,1)--++(1,2)--cycle ;
    \draw[tkzdecothreedim main color] (0,-3)--++(1,1)--++(2,-1)--cycle ;
    \draw[tkzdecothreedim main color] (3,0)--++(-1,-1)--++(-2,1)--cycle ;
    \draw[tkzdecothreedim main color] (3,0)--++(-1,1)--++(1,2)--cycle ;
  \end{scope}
  \draw (-3,-3) rectangle (3,3) ;
}

\newcommand\intpictotestautodautolen[4]{%
  \ifthenelse{\equal{#1}{auto}}{#2}{\ifthenelse{\equal{#1}{dauto}}{#3}{#4}}%
}

\newcommand\intpictotestdautolen[3]{%
  \ifthenelse{\equal{#1}{dauto}}{#2}{#3}%
}

\defKV[tkzthreedimdeco]{%
  ext color=\tikzset{tkzdecothreedim ext color/.style={fill=#1,line join=rect}},%
  main color=\tikzset{tkzdecothreedim main color/.style={fill=#1,line join=bevel}},%
  shadow color=\tikzset{tkzdecothreedim shadow color/.style={fill=#1,line join=bevel}},%
  shadow alt color=\tikzset{tkzdecothreedim shadow alt color/.style={fill=#1,line join=bevel}},%
  rescale=\def\tkzthreedimdecorescale{#1},%
  couleurs=\def\tkzthreedimdecocouls{#1},%
  strut=\def\tkzthreedimdecostrut{#1},%
  dstrut=\def\tkzthreedimdecodstrut{#1},%
  style=\def\tkzthreedimdecodstyle{#1}
}

\setKVdefault[tkzthreedimdeco]{%
  ext color=white,%
  main color=red,%
  shadow color=gray,%
  shadow alt color=lightgray,%
  rescale=1,%
  couleurs={violet,cyan,brown,yellow,red,green,teal,purple,pink},%
  strut={M},%
  dstrut={(qM)},%
  style=A
}

\NewDocumentCommand\tkzthreedimdeco{O{}D<>{}m}{%
  \restoreKV[tkzthreedimdeco]%
  \setKV[tkzthreedimdeco]{#1}%
  \intpictotestautodautolen{#3}%
    {%
      \settoheight\tkzdecothreedimheight{\hbox{\tkzthreedimdecostrut}}%
    }%
    {%
      \settototalheight\tkzdecothreedimheight{\hbox{\tkzthreedimdecodstrut}}%
      \settodepth\tkzdecothreedimdepth{\hbox{\tkzthreedimdecodstrut}}%
    }%
    {%
      \setlength\tkzdecothreedimheight{#3}%
    }%
  %style A
  \xdef\tkzdecothreedimscale{\fpeval{\tkzdecothreedimheight/50.4mm}}%
  \def\tkzdecothreedimlw{0.4}%
  %alt styles
  \ifthenelse{\equal{\tkzthreedimdecodstyle}{B}}%
    {%
      \xdef\tkzdecothreedimscale{\fpeval{\tkzdecothreedimheight/64.4mm}}%
    }%
    {}%
  \ifthenelse{\equal{\tkzthreedimdecodstyle}{C}}%
    {%
      \xdef\tkzdecothreedimscale{\fpeval{\tkzdecothreedimheight/121.2mm}}%
      \def\tkzdecothreedimlw{0.6}%
    }%
    {}%
  \ifthenelse{\equal{\tkzthreedimdecodstyle}{D}}%
    {%
      \xdef\tkzdecothreedimscale{\fpeval{\tkzdecothreedimheight/60.8mm}}%
    }%
    {}%
  %picture
  \intpictotestdautolen{#3}%
    {%
      \setlength\tkzdecothreedimdepth{\dimexpr-\tkzdecothreedimdepth+\fpeval{(1-\tkzthreedimdecorescale)/2}\tkzdecothreedimheight\relax}%
      \raisebox{\tkzdecothreedimdepth}{%
        \begin{tikzpicture}[line width=\fpeval{\tkzdecothreedimscale*\tkzdecothreedimlw}mm,scale=\fpeval{\tkzthreedimdecorescale*\tkzdecothreedimscale},#2,transform shape]
          \ifthenelse{\equal{\tkzthreedimdecodstyle}{A}}{\inttkzdecothreedimA}{}%
          \ifthenelse{\equal{\tkzthreedimdecodstyle}{B}}{\inttkzdecothreedimB}{}%
          \ifthenelse{\equal{\tkzthreedimdecodstyle}{C}}{\inttkzdecothreedimC}{}%
          \ifthenelse{\equal{\tkzthreedimdecodstyle}{D}}{\inttkzdecothreedimD}{}%
        \end{tikzpicture}%
      }%
    }%
    {%
      \begin{tikzpicture}[line width=\fpeval{\tkzthreedimdecorescale*\tkzdecothreedimscale*\tkzdecothreedimlw}mm,scale=\fpeval{\tkzthreedimdecorescale*\tkzdecothreedimscale},#2,transform shape]
        \ifthenelse{\equal{\tkzthreedimdecodstyle}{A}}{\inttkzdecothreedimA}{}%
        \ifthenelse{\equal{\tkzthreedimdecodstyle}{B}}{\inttkzdecothreedimB}{}%
        \ifthenelse{\equal{\tkzthreedimdecodstyle}{C}}{\inttkzdecothreedimC}{}%
        \ifthenelse{\equal{\tkzthreedimdecodstyle}{D}}{\inttkzdecothreedimD}{}%
      \end{tikzpicture}%
    }%
}

%====QUESTIONBLOCKMARIO
\definecolor{blockquestionyellow}{HTML}{fcd203}
\definecolor{blockquestiondarkyellow}{HTML}{8a740c}

\newlength\tkzquestionblockheight
\newlength\tkzquestionblockdepth

\newcommand\inttkzquestionblock{%
  %bg
  \draw[line width=\fpeval{\tkzquestionblockscale*3}mm,rounded corners=\fpeval{\tkzquestionblockscale*6}mm,fill=blockquestionyellow] (-5,-5) rectangle (5,5) ;
  %corners
  \foreach \x/\y in {-4/4,-4/-4,4/4,4/-4}{%
    \draw[line width=\fpeval{\tkzquestionblockscale*1.5}mm,fill=blockquestiondarkyellow] (\x,\y) circle[radius=0.35] ;
  }
  %question
  \draw[line width=\fpeval{\tkzquestionblockscale*1.5}mm,fill=white,line join=bevel] (-0.9,-3.75) rectangle (0.9,-2.5) ;
  \draw[line width=\fpeval{\tkzquestionblockscale*1.5}mm,fill=white,line join=bevel] (-0.9,-1.85)--++(1.8,0)--++(0,1)--++(0.25,0.25)--++(1.25,0)--++(0.75,0.75)--++(0,2.25)--++(-0.75,0.75)--++(-4.8,0)--++(-0.75,-0.75)--++(0,-1.75)--++(1.75,0)--++(0,1.25)--++(0.25,0.25)--++(2.3,0)--++(0.25,-0.25)--++(0,-1.35)--++(-0.25,-0.25)--++(-1.3,0)--++(-0.75,-0.75)--cycle;
}

\newcommand\inttkzquestionblockbw{%
  %bg
  \draw[line width=\fpeval{\tkzquestionblockscale*3}mm,rounded corners=\fpeval{\tkzquestionblockscale*6}mm] (-5,-5) rectangle (5,5) ;
  %corners
  \foreach \x/\y in {-4/4,-4/-4,4/4,4/-4}{%
    \draw[line width=\fpeval{\tkzquestionblockscale*1.5}mm] (\x,\y) circle[radius=0.35] ;
  }
  %question
  \ifboolKV[tkzquestionblock]{fill question}%
    {%
      \draw[line width=\fpeval{\tkzquestionblockscale*1.5}mm,line join=bevel,fill=black] (-0.9,-3.75) rectangle (0.9,-2.5) ;
      \draw[line width=\fpeval{\tkzquestionblockscale*1.5}mm,line join=bevel,fill=black] (-0.9,-1.85)--++(1.8,0)--++(0,1)--++(0.25,0.25)--++(1.25,0)--++(0.75,0.75)--++(0,2.25)--++(-0.75,0.75)--++(-4.8,0)--++(-0.75,-0.75)--++(0,-1.75)--++(1.75,0)--++(0,1.25)--++(0.25,0.25)--++(2.3,0)--++(0.25,-0.25)--++(0,-1.35)--++(-0.25,-0.25)--++(-1.3,0)--++(-0.75,-0.75)--cycle;
    }%
    {%
      \draw[line width=\fpeval{\tkzquestionblockscale*1.5}mm,line join=bevel] (-0.9,-3.75) rectangle (0.9,-2.5) ;
      \draw[line width=\fpeval{\tkzquestionblockscale*1.5}mm,line join=bevel] (-0.9,-1.85)--++(1.8,0)--++(0,1)--++(0.25,0.25)--++(1.25,0)--++(0.75,0.75)--++(0,2.25)--++(-0.75,0.75)--++(-4.8,0)--++(-0.75,-0.75)--++(0,-1.75)--++(1.75,0)--++(0,1.25)--++(0.25,0.25)--++(2.3,0)--++(0.25,-0.25)--++(0,-1.35)--++(-0.25,-0.25)--++(-1.3,0)--++(-0.75,-0.75)--cycle;
    }%
}

\defKV[tkzquestionblock]{%
  rescale=\def\tkzquestionblockrescale{#1},%
  strut=\def\tkzquestionblockstrut{#1},%
  dstrut=\def\tkzquestionblockdstrut{#1}
}

\setKVdefault[tkzquestionblock]{%
  rescale=1,%
  strut={M},%
  dstrut={(qM)},%
  bw=false,%
  fill question=false
}

\NewDocumentCommand\tkzquestionblock{O{}D<>{}m}{%
  \restoreKV[tkzquestionblock]%
  \setKV[tkzquestionblock]{#1}%
  \intpictotestautodautolen{#3}%
    {%
      \settoheight\tkzquestionblockheight{\hbox{\tkzquestionblockstrut}}%
    }%
    {%
      \settototalheight\tkzquestionblockheight{\hbox{\tkzquestionblockdstrut}}%
      \settodepth\tkzquestionblockdepth{\hbox{\tkzquestionblockdstrut}}%
    }%
    {%
      \setlength\tkzquestionblockheight{#3}%
    }%
  \xdef\tkzquestionblockscale{\fpeval{\tkzquestionblockheight/103mm}}%
  %picture
  \intpictotestdautolen{#3}%
    {%
      \setlength\tkzquestionblockdepth{\dimexpr-\tkzquestionblockdepth+\fpeval{(1-\tkzquestionblockrescale)/2}\tkzquestionblockheight\relax}%
      \raisebox{\tkzquestionblockdepth}{%
        \begin{tikzpicture}[scale=\fpeval{\tkzquestionblockrescale*\tkzquestionblockscale},#2,transform shape]
          \ifboolKV[tkzquestionblock]{bw}{\inttkzquestionblockbw}{\inttkzquestionblock}
        \end{tikzpicture}%
      }%
    }%
    {%
      \begin{tikzpicture}[scale=\fpeval{\tkzquestionblockrescale*\tkzquestionblockscale},#2,transform shape]
        \ifboolKV[tkzquestionblock]{bw}{\inttkzquestionblockbw}{\inttkzquestionblock}
      \end{tikzpicture}%
    }%
}

%====BRICKBLOCKMARIO
\definecolor{blockbrickbrown}{HTML}{b15c33}

\newlength\tkzbrickblockheight
\newlength\tkzbrickblockdepth

\tikzset{tkzbrickblock main color/.style={line width=\fpeval{\tkzbrickblockscale*3}mm,rounded corners=\fpeval{\tkzbrickblockscale*6}mm,fill=blockbrickbrown}}
\tikzset{tkzbrickblock bw/.style={line width=\fpeval{\tkzbrickblockscale*3}mm,rounded corners=\fpeval{\tkzbrickblockscale*6}mm}}

\newcommand\inttkzbrickblockbw{%
  %bg
  \draw[tkzbrickblock bw] (-5,-5) rectangle (0,{-1/3*5}) ;
  \draw[tkzbrickblock bw] (0,-5) rectangle (5,{-1/3*5}) ;
  \draw[tkzbrickblock bw] (-5,{-1/3*5}) rectangle (-2.5,{1/3*5}) ;
  \draw[tkzbrickblock bw] (-2.5,{-1/3*5}) rectangle (2.5,{1/3*5}) ;
  \draw[tkzbrickblock bw] (2.5,{-1/3*5}) rectangle (5,{1/3*5}) ;
  \draw[tkzbrickblock bw] (-5,{1/3*5}) rectangle (0,{5}) ;
  \draw[tkzbrickblock bw] (0,{1/3*5}) rectangle (5,5) ;
}

\newcommand\inttkzbrickblock{%
  %bg
  \draw[tkzbrickblock main color] (-5,-5) rectangle (0,{-1/3*5}) ;
  \draw[tkzbrickblock main color] (0,-5) rectangle (5,{-1/3*5}) ;
  \draw[tkzbrickblock main color] (-5,{-1/3*5}) rectangle (-2.5,{1/3*5}) ;
  \draw[tkzbrickblock main color] (-2.5,{-1/3*5}) rectangle (2.5,{1/3*5}) ;
  \draw[tkzbrickblock main color] (2.5,{-1/3*5}) rectangle (5,{1/3*5}) ;
  \draw[tkzbrickblock main color] (-5,{1/3*5}) rectangle (0,{5}) ;
  \draw[tkzbrickblock main color] (0,{1/3*5}) rectangle (5,5) ;
}

\defKV[tkzbrickblock]{%
  rescale=\def\tkzbrickblockrescale{#1},%
  strut=\def\tkzbrickblockstrut{#1},%
  dstrut=\def\tkzbrickblockdstrut{#1}
}

\setKVdefault[tkzbrickblock]{%
  rescale=1,%
  strut={M},%
  dstrut={(qM)},%
  bw=false
}

\NewDocumentCommand\tkzbrickblock{O{}D<>{}m}{%
  \restoreKV[tkzbrickblock]%
  \setKV[tkzbrickblock]{#1}%
  \intpictotestautodautolen{#3}%
  {%
    \settoheight\tkzbrickblockheight{\hbox{\tkzbrickblockstrut}}%
  }%
  {%
    \settototalheight\tkzbrickblockheight{\hbox{\tkzbrickblockdstrut}}%
    \settodepth\tkzbrickblockdepth{\hbox{\tkzbrickblockdstrut}}%
  }%
  {%
    \setlength\tkzbrickblockheight{#3}%
  }%
  \xdef\tkzbrickblockscale{\fpeval{\tkzbrickblockheight/103mm}}%
  %picture
  \intpictotestdautolen{#3}%
  {%
    \setlength\tkzbrickblockdepth{\dimexpr-\tkzbrickblockdepth+\fpeval{(1-\tkzbrickblockrescale)/2}\tkzbrickblockheight\relax}%
    \raisebox{\tkzbrickblockdepth}{%
      \begin{tikzpicture}[scale=\fpeval{\tkzbrickblockrescale*\tkzbrickblockscale},#2,transform shape]
        \ifboolKV[tkzbrickblock]{bw}{\inttkzbrickblockbw}{\inttkzbrickblock}
      \end{tikzpicture}%
    }%
  }%
  {%
    \begin{tikzpicture}[scale=\fpeval{\tkzbrickblockrescale*\tkzbrickblockscale},#2,transform shape]
      \ifboolKV[tkzbrickblock]{bw}{\inttkzbrickblockbw}{\inttkzbrickblock}
    \end{tikzpicture}%
  }%
}

%====QUESTIONBLOCKMARIO
\definecolor{blocksimplebrown}{HTML}{b15c33}

\newlength\tkzsimpleblockheight
\newlength\tkzsimpleblockdepth

\newcommand\inttkzsimpleblock{%
  %bg
  \draw[line width=\fpeval{\tkzsimpleblockscale*3}mm,rounded corners=\fpeval{\tkzsimpleblockscale*6}mm,fill=blocksimplebrown] (-5,-5) rectangle (5,5) ;
  %corners
  \foreach \x/\y in {-4/4,-4/-4,4/4,4/-4}{%
    \draw[line width=\fpeval{\tkzsimpleblockscale*1.5}mm,fill=black] (\x,\y) circle[radius=0.35] ;
  }
}

\newcommand\inttkzsimpleblockbw{%
  %bg
  \draw[line width=\fpeval{\tkzsimpleblockscale*3}mm,rounded corners=\fpeval{\tkzsimpleblockscale*6}mm] (-5,-5) rectangle (5,5) ;
  %corners
  \foreach \x/\y in {-4/4,-4/-4,4/4,4/-4}{%
    \draw[line width=\fpeval{\tkzsimpleblockscale*1.5}mm,fill=black] (\x,\y) circle[radius=0.35] ;
  }
}

\defKV[tkzsimpleblock]{%
  rescale=\def\tkzsimpleblockrescale{#1},%
  strut=\def\tkzsimpleblockstrut{#1},%
  dstrut=\def\tkzsimpleblockdstrut{#1}
}

\setKVdefault[tkzsimpleblock]{%
  rescale=1,%
  strut={M},%
  dstrut={(qM)},%
  bw=false
}

\NewDocumentCommand\tkzsimpleblock{O{}D<>{}m}{%
  \restoreKV[tkzsimpleblock]%
  \setKV[tkzsimpleblock]{#1}%
  \intpictotestautodautolen{#3}%
    {%
      \settoheight\tkzsimpleblockheight{\hbox{\tkzsimpleblockstrut}}%
    }%
    {%
      \settototalheight\tkzsimpleblockheight{\hbox{\tkzsimpleblockdstrut}}%
      \settodepth\tkzsimpleblockdepth{\hbox{\tkzsimpleblockdstrut}}%
    }%
    {%
      \setlength\tkzsimpleblockheight{#3}%
    }%
  \xdef\tkzsimpleblockscale{\fpeval{\tkzsimpleblockheight/103mm}}%
  %picture
  \intpictotestdautolen{#3}%
    {%
      \setlength\tkzsimpleblockdepth{\dimexpr-\tkzsimpleblockdepth+\fpeval{(1-\tkzsimpleblockrescale)/2}\tkzsimpleblockheight\relax}%
      \raisebox{\tkzsimpleblockdepth}{%
        \begin{tikzpicture}[scale=\fpeval{\tkzsimpleblockrescale*\tkzsimpleblockscale},#2,transform shape]
          \ifboolKV[tkzsimpleblock]{bw}{\inttkzsimpleblockbw}{\inttkzsimpleblock}
        \end{tikzpicture}%
      }%
    }%
    {%
      \begin{tikzpicture}[scale=\fpeval{\tkzsimpleblockrescale*\tkzsimpleblockscale},#2,transform shape]
        \ifboolKV[tkzsimpleblock]{bw}{\inttkzsimpleblockbw}{\inttkzsimpleblock}
      \end{tikzpicture}%
    }%
}

%====CHIBI HAMSTER (CC0 https://www.svgrepo.com/svg/110242/hamster)
\newlength\tkzchibihamsterheight
\newlength\tkzchibihamsterdepth

\definecolor{tkzchibihamsterA}{RGB}{255,201,194}
\definecolor{tkzchibihamsterB}{RGB}{254,167,147}
\definecolor{tkzchibihamsterC}{RGB}{89,18,0}

\tikzset{tkzchibihamster ear color/.style={fill=tkzchibihamsterA}}
\tikzset{tkzchibihamster body color/.style={fill=tkzchibihamsterB}}
\tikzset{tkzchibihamster border color/.style={fill=tkzchibihamsterC}}

\newcommand\intchibihamster{%
  \path[tkzchibihamster ear color] (4.1855, 12.4825).. controls (3.2468, 11.979) and (2.4713, 11.2105) .. (1.96, 10.2765) -- (1.96, 12.1972).. controls (1.96, 12.8218) and (2.4664, 13.3282) .. (3.091, 13.3282).. controls (3.6171, 13.3282) and (4.059, 12.969) .. (4.1855, 12.4825) -- cycle;
  \path[tkzchibihamster ear color] (11.5866, 12.1972) -- (11.5866, 10.2765).. controls (11.0751, 11.2105) and (10.2998, 11.979) .. (9.3609, 12.4822).. controls (9.4876, 12.969) and (9.9296, 13.3282) .. (10.4557, 13.3282).. controls (11.0803, 13.3282) and (11.5866, 12.8218) .. (11.5866, 12.1972) -- cycle;
  \path[tkzchibihamster body color] (11.5866, 10.2751).. controls (14.3356, 5.0667) and (12.8026, 0.2185) .. (6.7733, 0.2185).. controls (0.744, 0.2185) and (-0.7889, 5.0667) .. (1.96, 10.2751) -- (1.96, 10.2765).. controls (2.4713, 11.2105) and (3.2468, 11.979) .. (4.1855, 12.4825).. controls (4.9563, 12.8956) and (5.8376, 13.1301) .. (6.7733, 13.1301).. controls (7.7094, 13.1301) and (8.5903, 12.8958) .. (9.3609, 12.4822).. controls (10.2998, 11.979) and (11.0751, 11.2105) .. (11.5866, 10.2765) -- (11.5866, 10.2751) -- cycle;
  \path[tkzchibihamster border color] (4.9276, 9.9036) -- (3.9697, 10.0274).. controls (3.8501, 10.0429) and (3.7405, 9.9583) .. (3.725, 9.8387).. controls (3.7095, 9.719) and (3.794, 9.6095) .. (3.9137, 9.594) -- (4.6811, 9.4948) -- (4.6811, 9.1042).. controls (4.6811, 8.9836) and (4.779, 8.8857) .. (4.8996, 8.8857).. controls (5.0203, 8.8857) and (5.1181, 8.9836) .. (5.1181, 9.1042) -- (5.1181, 9.6869).. controls (5.1181, 9.7967) and (5.0366, 9.8895) .. (4.9276, 9.9036) -- cycle;
  \path[tkzchibihamster border color] (9.577, 10.0273) -- (8.619, 9.9035).. controls (8.5101, 9.8895) and (8.4285, 9.7967) .. (8.4285, 9.6869) -- (8.4285, 9.1042).. controls (8.4285, 8.9835) and (8.5264, 8.8857) .. (8.647, 8.8857).. controls (8.7677, 8.8857) and (8.8655, 8.9835) .. (8.8655, 9.1042) -- (8.8655, 9.4948) -- (9.633, 9.594).. controls (9.7526, 9.6094) and (9.8371, 9.719) .. (9.8217, 9.8386).. controls (9.8062, 9.9583) and (9.6968, 10.0429) .. (9.577, 10.0273) -- cycle;
  \path[tkzchibihamster border color] (13.099, 6.1373).. controls (12.9981, 7.4545) and (12.5509, 8.9028) .. (11.8052, 10.3289) -- (11.8052, 12.1971).. controls (11.8052, 12.9413) and (11.1998, 13.5467) .. (10.4557, 13.5467).. controls (9.9315, 13.5467) and (9.4638, 13.2445) .. (9.2418, 12.7868).. controls (8.4773, 13.1538) and (7.6343, 13.3487) .. (6.7733, 13.3487).. controls (5.9124, 13.3487) and (5.0694, 13.1538) .. (4.3049, 12.7869).. controls (4.0828, 13.2445) and (3.6152, 13.5467) .. (3.091, 13.5467).. controls (2.3469, 13.5467) and (1.7415, 12.9413) .. (1.7415, 12.1971) -- (1.7415, 10.3289).. controls (0.9958, 8.9028) and (0.5486, 7.4545) .. (0.4476, 6.1373).. controls (0.3446, 4.7926) and (0.6003, 3.5673) .. (1.1872, 2.5939).. controls (1.682, 1.7734) and (2.3988, 1.1338) .. (3.3176, 0.6931).. controls (4.2765, 0.2332) and (5.4391, 0.0) .. (6.7733, 0.0).. controls (8.1075, 0.0) and (9.2702, 0.2332) .. (10.229, 0.6931).. controls (11.1479, 1.1338) and (11.8647, 1.7734) .. (12.3594, 2.5939).. controls (12.9464, 3.5673) and (13.2021, 4.7926) .. (13.099, 6.1373) -- cycle(11.9852, 2.8195).. controls (11.0454, 1.2609) and (9.2431, 0.437) .. (6.7733, 0.437).. controls (4.3035, 0.437) and (2.5013, 1.2609) .. (1.5615, 2.8195).. controls (0.4468, 4.6682) and (0.6625, 7.3485) .. (2.1532, 10.1731).. controls (2.1698, 10.2045) and (2.1784, 10.2395) .. (2.1784, 10.275) -- (2.1784, 12.1971).. controls (2.1784, 12.7003) and (2.5878, 13.1097) .. (3.091, 13.1097).. controls (3.4506, 13.1097) and (3.7709, 12.8994) .. (3.9183, 12.5824).. controls (3.6112, 12.4048) and (3.3195, 12.1982) .. (3.0478, 11.9637).. controls (2.9565, 11.8848) and (2.9464, 11.7468) .. (3.0253, 11.6555).. controls (3.0685, 11.6054) and (3.1294, 11.5798) .. (3.1907, 11.5798).. controls (3.2413, 11.5798) and (3.2922, 11.5973) .. (3.3334, 11.6329).. controls (4.2883, 12.4576) and (5.51, 12.9117) .. (6.7734, 12.9117).. controls (8.0367, 12.9117) and (9.2583, 12.4576) .. (10.2132, 11.633).. controls (10.3046, 11.5541) and (10.4426, 11.5642) .. (10.5214, 11.6555).. controls (10.6003, 11.7469) and (10.5902, 11.8848) .. (10.4988, 11.9637).. controls (10.2272, 12.1983) and (9.9355, 12.4048) .. (9.6284, 12.5824).. controls (9.7758, 12.8994) and (10.096, 13.1097) .. (10.4557, 13.1097).. controls (10.9588, 13.1097) and (11.3682, 12.7003) .. (11.3682, 12.1971) -- (11.3682, 10.275).. controls (11.3682, 10.2395) and (11.3769, 10.2045) .. (11.3935, 10.1731).. controls (12.8842, 7.3485) and (13.0999, 4.6682) .. (11.9852, 2.8195) -- cycle;
  \path[tkzchibihamster border color] (7.3061, 7.4572).. controls (7.1657, 7.4572) and (7.0467, 7.5496) .. (7.0065, 7.6768) -- (7.3672, 7.897).. controls (7.4702, 7.9599) and (7.5027, 8.0944) .. (7.4398, 8.1974).. controls (7.377, 8.3004) and (7.2425, 8.3329) .. (7.1395, 8.27) -- (6.7733, 8.0465) -- (6.4071, 8.27).. controls (6.304, 8.3329) and (6.1696, 8.3004) .. (6.1068, 8.1974).. controls (6.0439, 8.0944) and (6.0764, 7.9599) .. (6.1794, 7.897) -- (6.5402, 7.6768).. controls (6.4999, 7.5496) and (6.3808, 7.4572) .. (6.2406, 7.4572).. controls (6.1199, 7.4572) and (6.0221, 7.3593) .. (6.0221, 7.2387).. controls (6.0221, 7.118) and (6.1199, 7.0202) .. (6.2406, 7.0202).. controls (6.4486, 7.0202) and (6.6371, 7.1052) .. (6.7733, 7.2423).. controls (6.9094, 7.1052) and (7.098, 7.0202) .. (7.306, 7.0202).. controls (7.4267, 7.0202) and (7.5245, 7.118) .. (7.5245, 7.2387).. controls (7.5245, 7.3593) and (7.4267, 7.4572) .. (7.3061, 7.4572) -- cycle;
}

\defKV[tkzchibihamster]{%
  rescale=\def\tkzchibihamsterrescale{#1},%
  strut=\def\tkzchibihamsterstrut{#1},%
  dstrut=\def\tkzchibihamsterdstrut{#1},%
  ear color=\tikzset{tkzchibihamster ear color/.style={fill=#1}},%
  body color=\tikzset{tkzchibihamster body color/.style={fill=#1}},%
  border color=\tikzset{tkzchibihamster border color/.style={fill=#1}}
}

\setKVdefault[tkzchibihamster]{%
  rescale=1,%
  strut={M},%
  dstrut={(qM)},%
  bw=false,%
  ear color=tkzchibihamsterA,%
  body color=tkzchibihamsterB,%
  border color=tkzchibihamsterC
}

\NewDocumentCommand\tkzhamsterkawaii{ O{} D<>{} m }{%
  \restoreKV[tkzchibihamster]%
  \setKV[tkzchibihamster]{#1}%
  \intpictotestautodautolen{#3}%
    {%
      \settoheight\tkzchibihamsterheight{\hbox{\tkzchibihamsterstrut}}%
    }%
    {%
      \settototalheight\tkzchibihamsterheight{\hbox{\tkzchibihamsterdstrut}}%
      \settodepth\tkzchibihamsterdepth{\hbox{\tkzchibihamsterdstrut}}%
    }%
    {%
      \setlength\tkzchibihamsterheight{#3}%
    }%
  \xdef\tkzchibihamsterscale{\fpeval{\tkzchibihamsterheight/135.5mm}}%
  %bw
  \ifboolKV[tkzchibihamster]{bw}%
    {%
      \tikzset{tkzchibihamster ear color/.style={fill=lightgray!25}}%
      \tikzset{tkzchibihamster body color/.style={fill=gray!25}}%
      \tikzset{tkzchibihamster border color/.style={fill=darkgray}}%
    }%
    {}%
  %picture
  \intpictotestdautolen{#3}%
    {%
      \setlength\tkzchibihamsterdepth{\dimexpr-\tkzchibihamsterdepth+\fpeval{(1-\tkzchibihamsterrescale)/2}\tkzchibihamsterheight\relax}%
      \raisebox{\tkzchibihamsterdepth}{%
        \begin{tikzpicture}[scale=\fpeval{\tkzchibihamsterrescale*\tkzchibihamsterscale},#2,transform shape]
          \clip (0.41,0) rectangle (13.12,13.55) ;
          \intchibihamster
        \end{tikzpicture}%
      }%
    }%
    {%
      \begin{tikzpicture}[scale=\fpeval{\tkzchibihamsterrescale*\tkzchibihamsterscale},#2,transform shape]
      \clip (0.41,0) rectangle (13.12,13.55) ;
        \intchibihamster
      \end{tikzpicture}%
    }%
}

%====SPIDERCAB
\newlength\tkzspidercabheight
\newlength\tkzspidercabdepth

\defKV[tkzspidercab]{%
  levels=\def\tkzspidercablevel{#1},%
  rescale=\def\tkzspidercabrescale{#1},%
  strut=\def\tkzspidercabstrut{#1},%
  dstrut=\def\tkzspidercabdstrut{#1},%
  inner margin=\def\tkzspidercabstart{#1}
}
\setKVdefault[tkzspidercab]{%
  levels=5,%
  rescale=1,%
  strut={M},%
  dstrut={(qM)},%
  inner margin=0.85
}

\newcommand\inttkzspidercab{
  %cab
  \foreach \i in {0,...,10}{\draw (0,0)--({\i/12*360}:5);}
  \draw[line width=\fpeval{\tkzspidercabscale*0.5}mm] (0,0)--({11/12*360}:{5-\tkzspidercabstart});
  \foreach \i in {0,...,\inteval{12*\tkzspidercablevel}}{%
    \xdef\j{\inteval{1-\i}}%
    \draw ({\j/12*360}:{\tkzspidercabstart+\i*\tkzspidercaboffset}) to[bend left=-20] ({(\j-1)/12*360}:{\tkzspidercabstart+(\i+1)*\tkzspidercaboffset}) ;
  }
  \draw (0:{\tkzspidercabstart+(12*\tkzspidercablevel+1)*\tkzspidercaboffset})--++(0,{-0.55*5}) ;
  %spider
  \coordinate (SPIDER) at ({\tkzspidercabstart+(12*\tkzspidercablevel+1)*\tkzspidercaboffset},{-0.55*5}) ;
  \filldraw (SPIDER) circle[x radius=0.6cm,y radius=0.35cm] ;
  \begin{scope}[line width=\fpeval{\tkzspidercabscale*0.8}mm]
    \draw[line cap=round] ([xshift=0.1cm]SPIDER) to[bend left=45]++ (0.75cm,0.2cm) ;
    \draw[line cap=round] ([xshift=0.1cm,yshift=-0.025cm]SPIDER) to[bend left=30]++ (0.675cm,0.05cm) ;
    \draw[line cap=round] ([xshift=0.1cm,yshift=-0.1cm]SPIDER) to[bend left=60]++ (0.625cm,-0.2cm) ;
    \draw[line cap=round] ([xshift=-0.1cm]SPIDER) to[bend right=45]++ (-0.75cm,0.2cm) ;
    \draw[line cap=round] ([xshift=-0.1cm,yshift=-0.025cm]SPIDER) to[bend right=30]++ (-0.675cm,0.05cm) ;
    \draw[line cap=round] ([xshift=-0.1cm,yshift=-0.1cm]SPIDER) to[bend right=60]++ (-0.625cm,-0.2cm) ;
  \end{scope}
  \draw[fill=white] ([xshift=-0.2cm,yshift=0.4cm]SPIDER) circle[x radius=0.2cm,y radius=0.275cm] ;
  \draw[fill=white] ([xshift=0.2cm,yshift=0.4cm]SPIDER) circle[x radius=0.2cm,y radius=0.275cm] ;
  \filldraw ([xshift=-0.175cm,yshift=0.35cm]SPIDER) circle[radius=0.05cm] ;
  \filldraw ([xshift=0.175cm,yshift=0.35cm]SPIDER) circle[radius=0.05cm] ;
}

\NewDocumentCommand\tkzspidercabweb{ O{} D<>{} m }{%
  \restoreKV[tkzspidercab]%
  \setKV[tkzspidercab]{#1}%
  \intpictotestautodautolen{#3}%
    {%
      \settoheight\tkzspidercabheight{\hbox{\tkzspidercabstrut}}%
    }%
    {%
      \settototalheight\tkzspidercabheight{\hbox{\tkzspidercabdstrut}}%
      \settodepth\tkzspidercabdepth{\hbox{\tkzspidercabdstrut}}%
    }%
    {%
      \setlength\tkzspidercabheight{#3}%
    }%
  \xdef\tkzspidercabscale{\fpeval{\tkzspidercabheight/100.6mm}}%
  \def\tkzspidercaboffset{\fpeval{(5-2*\tkzspidercabstart)/(12*\tkzspidercablevel)}}%calcul automatique
  %picture
  \intpictotestdautolen{#3}%
    {%
      \setlength\tkzspidercabdepth{\dimexpr-\tkzspidercabdepth+\fpeval{(1-\tkzspidercabrescale)/2}\tkzspidercabheight\relax}%
      \raisebox{\tkzspidercabdepth}{%
        \begin{tikzpicture}[scale=\fpeval{\tkzspidercabrescale*\tkzspidercabscale},line width=\fpeval{\tkzspidercabrescale*\tkzspidercabscale*0.6}mm,#2,transform shape]
          \inttkzspidercab
        \end{tikzpicture}%
      }%
    }%
    {%
      \begin{tikzpicture}[scale=\fpeval{\tkzspidercabrescale*\tkzspidercabscale},line width=\fpeval{\tkzspidercabrescale*\tkzspidercabscale*0.6}mm,#2,transform shape]
        \inttkzspidercab
      \end{tikzpicture}%
    }%
}

%====DONUT
\newlength\tkzdonutheight
\newlength\tkzdonutdepth

\definecolor{tkzdonutpastry}{HTML}{dcc6aa}
\definecolor{tkzdonutjelly}{HTML}{e89dd5}

\defKV[tkzdonut]{%
  rescale=\def\tkzdonutrescale{#1},%
  strut=\def\tkzdonutstrut{#1},%
  dstrut=\def\tkzdonutdstrut{#1},%
  main color=\def\tkzdonutmaincolor{#1},%
  deco color=\def\tkzdonutdecocolor{#1}
}
\setKVdefault[tkzdonut]{%
  rescale=1,%
  strut={M},%
  dstrut={(qM)},%
  main color=tkzdonutpastry,%
  deco color=tkzdonutjelly,%
  decorations=true,%
  bw=false
}

\newcommand\inttkzdonutdeco[1]{%
  \begin{scope}[line width=\fpeval{\tkzdonutscale*0.0875}cm]
    \foreach \ptpos/\ptcolor in {#1} {%
      \draw[fill={\ptcolor}] \ptpos circle[radius=0.15cm] ;
    }
  \end{scope}
}

\newcommand\inttkzdonut{%
  \path (6.5cm,0) arc [start angle=0,end angle=180,x radius=6.5cm,y radius=4cm] node [pos=0.075] (YYY-1) {} node [pos=0.925] (YYY-2) {} ;
  \ifboolKV[tkzdonut]{bw}%
    {%
      \draw[fill=white] (0,0) circle[x radius=6.5cm,y radius=4cm] ;
      \draw[fill=lightgray!25] plot[smooth,tension=1] coordinates {(YYY-2)(-5.75,-0.75)(-4.75,-0.25)(-4.35,-1.75)(-3,-1.25)(-2,-3)(-0.25,-2.15)(1,-3.1)(2.25,-2)(3.25,-2.5)(4,-1.5)(5.15,-1.5)(5.5,-0.5)(6.125,-0.5)(YYY-1)} arc [start angle=13.5,end angle=166.5,x radius=6.5cm,y radius=4cm] ;
      \draw[line cap=round] (3,1.5) to[bend left=40] node [pos=0.2] (ZZZ-1) {} node [pos=0.8] (ZZZ-2) {}  (-3,1.5) ;
      \draw[fill=white] (ZZZ-1.center) to[bend right=35] (ZZZ-2.center) to[bend right=25] cycle ;
    }%
    {%
      \draw[fill={\tkzdonutmaincolor}] (0,0) circle[x radius=6.5cm,y radius=4cm] ;
      \draw[fill={\tkzdonutdecocolor}] plot[smooth,tension=1] coordinates {(YYY-2)(-5.75,-0.75)(-4.75,-0.25)(-4.35,-1.75)(-3,-1.25)(-2,-3)(-0.25,-2.15)(1,-3.1)(2.25,-2)(3.25,-2.5)(4,-1.5)(5.15,-1.5)(5.5,-0.5)(6.125,-0.5)(YYY-1)} arc [start angle=13.5,end angle=166.5,x radius=6.5cm,y radius=4cm] ;
      \draw[line cap=round] (3,1.5) to[bend left=40] node [pos=0.2] (ZZZ-1) {} node [pos=0.8] (ZZZ-2) {}  (-3,1.5) ;
      \draw[fill={\tkzdonutmaincolor}] (ZZZ-1.center) to[bend right=35] (ZZZ-2.center) to[bend right=25] cycle ;
    }%
  \ifboolKV[tkzdonut]{decorations}%
    {%
      %decorations
      \inttkzdonutdeco{(-5.75,0.75)/white,(-4.5,0.5)/white,(-4,2)/white,(-3.5,1.15)/white,(-2.5,0)/white,(-2.5,2.5)/white,(-1,-1.25)/white,(-0.1,-0.5)/white,(-1,3.25)/white,(-1.25,2.25)/white,(0,3.15)/white,(1,2.25)/white,(1.75,-1.5)/white,(2.5,2)/white,(3,0)/white,(3,3)/white,(4,-0.5)/white,(4,2.25)/white,(5,1)/white}
    }%
    {}%
}

\NewDocumentCommand\tkzdonut{ O{} D<>{} m }{%
  \restoreKV[tkzdonut]%
  \setKV[tkzdonut]{#1}%
  \intpictotestautodautolen{#3}%
    {%
      \settoheight\tkzdonutheight{\hbox{\tkzdonutstrut}}%
    }%
    {%
      \settototalheight\tkzdonutheight{\hbox{\tkzdonutdstrut}}%
      \settodepth\tkzdonutdepth{\hbox{\tkzdonutdstrut}}%
    }%
    {%
      \setlength\tkzdonutheight{#3}%
    }%
  \xdef\tkzdonutscale{\fpeval{\tkzdonutheight/82.5mm}}%
  %picture
  \intpictotestdautolen{#3}%
    {%
      \setlength\tkzdonutdepth{\dimexpr-\tkzdonutdepth+\fpeval{(1-\tkzdonutrescale)/2}\tkzdonutheight\relax}%
      \raisebox{\tkzdonutdepth}{%
        \begin{tikzpicture}[scale=\fpeval{\tkzdonutrescale*\tkzdonutscale},line width=\fpeval{\tkzdonutrescale*\tkzdonutscale*0.25}cm,transform shape]
          \inttkzdonut
        \end{tikzpicture}%
      }%
    }%
    {%
      \begin{tikzpicture}[scale=\fpeval{\tkzdonutrescale*\tkzdonutscale},line width=\fpeval{\tkzdonutrescale*\tkzdonutscale*0.25}cm,transform shape]
        \inttkzdonut
      \end{tikzpicture}%
    }%
}

%====POOLBALL
\usetikzlibrary{shadings}

\newlength\tkzpoolballheight
\newlength\tkzpoolballdepth

\defKV[tkzpoolball]{%
  font=\tikzset{poolball font/.style={font=#1}},%
  rescale=\def\tkzpoolballrescale{#1},%
  strut=\def\tkzpoolballstrut{#1},%
  dstrut=\def\tkzpoolballdstrut{#1},%
  color=\colorlet{tkzpoolballmaincolor}{#1},%
  number=\def\tkzpoolballnb{#1},%
  xscale=\def\tkzpoolballxscale{#1},%
  rotate=\def\tkzpoolballrotate{#1}
}
\setKVdefault[tkzpoolball]{%
  font=\sffamily,%
  rescale=1,%
  strut={M},%
  dstrut={(qM)},%
  color=red,%
  number={},%
  xscale=1,%
  rotate=0
}

\newcommand\inttkzpoolball[1]{%
  %clip pour la Rotation
  \useasboundingbox (0,0) circle[radius=1cm] ;
  \fill[upper left=tkzpoolballmaincolor!50,upper right=tkzpoolballmaincolor!80,lower left=tkzpoolballmaincolor!80,lower right=tkzpoolballmaincolor] (0,0) circle[radius=1cm] ;
  \begin{scope}[rotate=\tkzpoolballrotate]
    \clip (0,0) circle[radius=1cm] ;
    \fill[white!95!tkzpoolballmaincolor] (1.5cm,0) circle[radius=0.675cm] ;
    \fill[white!95!tkzpoolballmaincolor] (-1.5cm,0) circle[radius=0.675cm] ;
    \fill[white!95!tkzpoolballmaincolor] (0,1.5cm) circle[radius=0.675cm] ;
    \fill[white!95!tkzpoolballmaincolor] (0,-1.5cm) circle[radius=0.675cm] ;
    \fill[white] (0,0) circle[radius=0.5cm] ;
  \end{scope}
  \begin{scope}[rotate=\tkzpoolballrotate]
    \clip (0,0) circle[radius=0.5cm] ;
    \ifthenelse{\equal{\tkzpoolballnb}{}}%
      {}%
      {%
        \draw (0,0) node[inner sep=0pt,poolball font,xscale=\tkzpoolballxscale] {\resizebox*{!}{0.6cm}{\tkzpoolballnb}} ;
      }%
  \end{scope}
  \draw[tkzpoolballmaincolor!25!black,line width=\fpeval{\tkzpoolballscale*0.2}mm] (0,0) circle[radius=1cm] ;
}

\NewDocumentCommand\tkzpoolball{ O{} D<>{} m }{%
  \restoreKV[tkzpoolball]%
  \setKV[tkzpoolball]{#1}%
  \intpictotestautodautolen{#3}%
  {%
    \settoheight\tkzpoolballheight{\hbox{\tkzpoolballstrut}}%
  }%
  {%
    \settototalheight\tkzpoolballheight{\hbox{\tkzpoolballdstrut}}%
    \settodepth\tkzpoolballdepth{\hbox{\tkzpoolballdstrut}}%
  }%
  {%
    \setlength\tkzpoolballheight{#3}%
  }%
  \xdef\tkzpoolballscale{\fpeval{\tkzpoolballheight/20.2mm}}%
  %picture
  \intpictotestdautolen{#3}%
  {%
    \setlength\tkzpoolballdepth{\dimexpr-\tkzpoolballdepth+\fpeval{(1-\tkzpoolballrescale)/2}\tkzpoolballheight\relax}%
    \raisebox{\tkzpoolballdepth}{%
      \begin{tikzpicture}[scale=\fpeval{\tkzpoolballrescale*\tkzpoolballscale},transform shape]
        \inttkzpoolball{\tkzpoolballnb}
      \end{tikzpicture}%
    }%
  }%
  {%
    \begin{tikzpicture}[scale=\fpeval{\tkzpoolballrescale*\tkzpoolballscale},transform shape]
      \inttkzpoolball{\tkzpoolballnb}
    \end{tikzpicture}%
  }%
}

%====EXCALAMATION
\newlength\tmptkzexclaheight
\newlength\tmptkzexcladepth

\defKV[tkzexclamation]{%
  rescale=\def\tkzexclarescale{#1},%
  strut=\def\tkzexclastrut{#1},%
  dstrut=\def\tkzexcladstrut{#1}
}
\setKVdefault[tkzexclamation]{%
  rescale=1,%
  strut={M},%
  dstrut={(qM)}
}

\newcommand\inttkzexcla{
  \useasboundingbox (0.05,0) circle[radius=1] ;
  \fill[even odd rule] (0.05,0) circle[radius=1] (0.129,-0.651) circle[x radius=0.275,y radius=0.18] plot[smooth,line join=round] coordinates {(0,-0.4) (-0.274,0.196) (-0.347,0.658) (0.03,0.874) (0.2,0.8) (0.248,0.535) (0.224,0.264) (0.1,-0.385) (0,-0.4)};
}

\NewDocumentCommand\tkzexcla{ O{} D<>{} m }{%
  \restoreKV[tkzexclamation]%
  \setKV[tkzexclamation]{#1}%
  \intpictotestautodautolen{#3}%
  {%
    \settoheight\tmptkzexclaheight{\hbox{\tkzexclastrut}}%
  }%
  {%
    \settototalheight\tmptkzexclaheight{\hbox{\tkzexcladstrut}}%
    \settodepth\tmptkzexcladepth{\hbox{\tkzexcladstrut}}%
  }%
  {%
    \setlength\tmptkzexclaheight{#3}%
  }%
  \intpictotestdautolen{#3}%
    {%
      \setlength\tmptkzexcladepth{\dimexpr-\tmptkzexcladepth+\fpeval{(1-\tkzexclarescale)/2}\tmptkzexclaheight\relax}%
      \raisebox{\tmptkzexcladepth}{%
        \begin{tikzpicture}[x=\fpeval{\tkzexclarescale*0.5}\tmptkzexclaheight,y=\fpeval{\tkzexclarescale*0.5}\tmptkzexclaheight,#2]
          \inttkzexcla
        \end{tikzpicture}%
      }%
    }%
    {%
      \begin{tikzpicture}[x=0.5\tmptkzexclaheight,y=0.5\tmptkzexclaheight,#2]
        \inttkzexcla
      \end{tikzpicture}%
    }%
}

%\tkzllslevels[hauteur=(d)auto|<dim>]<tikz keys>{niveau}
\definecolor{llsnivbleu}{HTML}{b9d4ef}
\definecolor{llsnivvert}{HTML}{68b652}
\definecolor{llsnivorange}{HTML}{f29228}
\definecolor{llsnivrouge}{HTML}{da360a}

\ExplSyntaxOn

\int_new:N   \l_llsniv_niveau_int
\fp_new:N    \l_llsniv_rescale_fp
\fp_const:Nn \c_llsniv_compensation_fp { 1 / 1.05 }
\tl_new:N    \l_llsniv_hauteur_tl
\tl_new:N    \l_llsniv_couleur_tl
\tl_new:N    \l_llsniv_strut_tl
\tl_new:N    \l_llsniv_dstrut_tl
\dim_new:N   \l_llsniv_profondeur_dim
\dim_new:N   \l_llsniv_baseline_dim
\dim_new:N   \l_llsniv_height_dim

\tikzset{llsnivdiff~bordure/.style={line~width=0.05\l_llsniv_height_dim}}
\tikzset{llsnivdiff~barre/.style={line~width=0.1\l_llsniv_height_dim,llsnivbleu}}

\keys_define:nn { llsniv }
{
  level   .int_set:N = \l_llsniv_niveau_int,
  level   .initial:n = 1,
  strut   .tl_set:N = \l_llsniv_strut_tl,
  strut   .initial:n = M,
  dstrut  .tl_set:N = \l_llsniv_dstrut_tl,
  dstrut  .initial:n = (qM),
  height  .tl_set:N  = \l_llsniv_hauteur_tl,
  height  .initial:n = dauto,
  rescale .fp_set:N  = \l_llsniv_rescale_fp,
  rescale .initial:n = 1,
}

\cs_new_protected:Nn \llsniv_couleur:n
{
  \tl_set:Nx \l_llsniv_couleur_tl
  {
    \int_case:nn { #1 }
    {
      { 1 } { llsnivvert   }
      { 2 } { llsnivorange }
      { 3 } { llsnivrouge  }
    }
  }
}

\cs_new_protected:Nn \llsniv_mesures:
{
  \tl_if_eq:NnTF \l_llsniv_hauteur_tl { auto }
  {
    \hbox_set:Nn \l_tmpa_box { \l_llsniv_strut_tl }
    \dim_set:Nn \l_llsniv_profondeur_dim { 0pt }
    \dim_set:Nn \l_llsniv_height_dim { \box_ht:N \l_tmpa_box }
  }
  {
    \tl_if_eq:NnTF \l_llsniv_hauteur_tl { dauto }
      {
        \hbox_set:Nn \l_tmpa_box { \l_llsniv_dstrut_tl }
        \dim_set:Nn \l_llsniv_profondeur_dim { \box_dp:N \l_tmpa_box }
        \dim_set:Nn \l_llsniv_height_dim
          { \box_ht:N \l_tmpa_box + \box_dp:N \l_tmpa_box }
      }
      {
        \dim_set:Nn \l_llsniv_height_dim { \l_llsniv_hauteur_tl }
        \dim_set:Nn \l_llsniv_profondeur_dim { 0pt }
      }
  }
  \dim_set:Nn \l_llsniv_baseline_dim
    { \l_llsniv_profondeur_dim - 0.5\l_llsniv_height_dim }
  \dim_set:Nn \l_llsniv_height_dim
    {
      \fp_to_decimal:n { \l_llsniv_rescale_fp * \c_llsniv_compensation_fp }
      \l_llsniv_height_dim
    }
}

% dessine le disque "niveau atteint" n°i (i = 1, 2, 3 -> x = 0, 2.75, 5.5)
\cs_new_protected:Nn \llsniv_cercle:n
{
  \draw[llsnivdiff~bordure, draw=\l_llsniv_couleur_tl, fill=white]
    ( { (#1-1)*2.5 } , 0 ) circle[radius=1] ;
  \fill[\l_llsniv_couleur_tl]
    ( { (#1-1)*2.5 } , 0 ) circle[radius=0.85] ;
}

\NewDocumentCommand \tkzllslevels { O { } D < > { } m }
{
  \group_begin:
  \keys_set:nn { llsniv } { level = #3, #1 }
  \llsniv_mesures:
  \llsniv_couleur:n { \l_llsniv_niveau_int }
  \begin{tikzpicture}
    [
      x=0.5\l_llsniv_height_dim,
      y=0.5\l_llsniv_height_dim, 
      baseline={(0,\dim_use:N \l_llsniv_baseline_dim)},
      #2
    ]
    \useasboundingbox (-1.05,-1.05) rectangle (6.05,1.05);
    \draw[llsnivdiff~barre] (0,0)--(5,0);
    \fill[lightgray] (0,0)    circle[radius=0.85]
                     (2.5,0) circle[radius=0.85]
                     (5,0)  circle[radius=0.85] ;
    \int_step_function:nnN { 1 } { \l_llsniv_niveau_int } \llsniv_cercle:n
  \end{tikzpicture}
  \group_end:
}

\ExplSyntaxOff

%====MATHMAN
\newcommand\inttkzmathman[2][]{%
  %--legs
  \path (-70:1.5) to[bend left=5] coordinate[pos=0.215] (brasD) ++(0.7,-3.5) coordinate (basD) ;
  \path (-110:1.5) to[bend right=5] coordinate[pos=0.215] (brasG) ++(-0.7,-3.5) coordinate (basG) ;
  \ifthenelse{\equal{\tkzmathmandbodycol}{}}%
    {}%
    {%
      \colorlet{tkzmathmanbodcol}{\tkzmathmandbodycol}
      \filldraw[tkzmathmanbodcol] (-70:1.5) to[bend left=5] (basD) to[bend left=15] (basG) to[bend left=5] (-110:1.5) arc(-110:-70:1.5) ;
    }%
  \draw (-70:1.5) to[bend left=5] (basD) ;
  \draw (-110:1.5) to[bend right=5] (basG) ;
  %--head
  \draw (0,0) circle [radius=1.5] ;
  \filldraw (-0.575,0.2) circle[radius=0.15] ;
  \filldraw (0.3,0.215) circle[radius=0.15] ;
  \draw[fill=tkzmathmanmouth] (-0.65,-0.325) to[bend right=10] (0.3,-0.25) to[bend left=70,looseness=2] (-0.65,-0.325) ;
  %--arms
  \def\intrightarm{ node{}}\def\intleftarm{ node{}}
  \ifthenelse{\equal{#2}{lin}}%
  {\def\intrightarm{--++ (1.6,1.6)}\def\intleftarm{--++ (-1.6,-1.6)}}{}%
  \ifthenelse{\equal{#2}{quad}}%
  {\def\intrightarm{to[bend right=25]++ (1.5,2.5)}\def\intleftarm{to[bend left=25]++ (-1.5,2.5)}}{}%
  \ifthenelse{\equal{#2}{cub}}%
  {\def\intrightarm{to[bend right=22]++ (1.5,2.5)}\def\intleftarm{to[bend right=22]++ (-1.5,-2.5)}}{}%
  \ifthenelse{\equal{#2}{sin}}%
  {\def\intrightarm{to[bend left=65,looseness=1.5]++ (2,0)}\def\intleftarm{to[bend left=65,looseness=1.5]++ (-2,0)}}{}%
  \ifthenelse{\equal{#2}{cos}}%
  {\def\intrightarm{plot[smooth,tension=1,shift=(brasD)] coordinates {(0,0) (0.65,0.125) (1.5,-0.8) (2,-0.7)}}\def\intleftarm{plot[smooth,tension=1,shift=(brasG)] coordinates {(0,0) (-0.65,0.125) (-1.5,-0.8) (-2,-0.7)}}}{}%
  \ifthenelse{\equal{#2}{tan}}%
  {\def\intrightarm{to[bend right=15]++ (1.35,2.5)}\def\intleftarm{to[bend right=15]++ (-1.35,-2.5)}}{}%
  \ifthenelse{\equal{#2}{cot}}%
  {\def\intrightarm{to[bend left=15]++ (1.35,-2.5)}\def\intleftarm{to[bend left=15]++ (-1.35,2.5)}}{}%
  \ifthenelse{\equal{#2}{abs}}%
  {\def\intrightarm{--++ (1.6,1.6)}\def\intleftarm{--++ (-1.6,1.6)}}{}%
  \ifthenelse{\equal{#2}{-abs}}%
  {\def\intrightarm{--++ (1.6,-1.6)}\def\intleftarm{--++ (-1.6,-1.6)}}{}%
  \ifthenelse{\equal{#2}{-lin}}%
  {\def\intrightarm{--++ (1.6,-1.6)}\def\intleftarm{--++ (-1.6,1.6)}}{}%
  \ifthenelse{\equal{#2}{log}}%
  {\def\intrightarm{to[bend right=12]++ (2,-0.4)}\def\intleftarm{to[bend left=30]++ (120:2.5)}}{}%
  \ifthenelse{\equal{#2}{exp}}%
  {\def\intrightarm{to[bend right=30]++ (60:2.5)}\def\intleftarm{to[bend left=12]++ (-2,-0.4)}}{}%
  \ifthenelse{\equal{#2}{ccart}}%
  {\def\intrightarm{to[bend right=80,looseness=1.375] (85:2)}\def\intleftarm{to[bend left=80,looseness=1.375] (95:2)}}{}%
  \ifthenelse{\equal{#2}{-inv}}%
  {\def\intrightarm{plot[smooth,tension=1,shift=(brasD)] coordinates {(0,0) (0.5,-0.4) (-0.5,-1) (-1,-1.65)}}\def\intleftarm{plot[smooth,tension=1,shift=(brasG)] coordinates {(0,0) (-0.5,0.4) (0.5,1) (1,1.65)}}}{}%
  \ifthenelse{\equal{#2}{inv}}%
  {\def\intleftarm{plot[smooth,tension=1,shift=(brasG)] coordinates {(0,0) (-0.5,-0.4) (0.5,-1) (1,-1.65)}}\def\intrightarm{plot[smooth,tension=1,shift=(brasD)] coordinates {(0,0) (0.5,0.4) (-0.5,1) (-1,1.65)}}}{}%
  \draw[tkzmathmancol] (brasD) \intrightarm ;
  \draw[tkzmathmancol] (brasG) \intleftarm ;
  %arms circle phantom (valign)
  \ifboolKV[tkzmathman]{vstrut}%
    {%
      \path (brasD) to[bend right=80,looseness=1.375] (85:2) ;
      \path (brasG) to[bend left=80,looseness=1.375] (95:2) ;
    }%
    {}%
}

\newlength\intmathmanheight
\newlength\intmathmandepth

\defKV[tkzmathman]{%
  strut=\def\tkzmathmanstrut{#1},%
  dstrut=\def\tkzmathmandstrut{#1},%
  fct color=\colorlet{tkzmathmancol}{#1},%
  body color=\def\tkzmathmandbodycol{#1}
}
\setKVdefault[tkzmathman]{%
  strut={M},%
  dstrut={(qM)},%
  vstrut=false,%
  fct color=red,%
  body color={},%
  bw=true
}

\NewDocumentCommand\tkzmathman{ O{} D<>{} m m }{%clés + tikz + hauteur + type
  \restoreKV[tkzmathman]%
  \setKV[tkzmathman]{#1}%
  \intpictotestautodautolen{#3}%
    {%
      \settoheight\intmathmanheight{\hbox{\tkzmathmanstrut}}%
    }%
    {%
      \settototalheight\intmathmanheight{\hbox{\tkzmathmandstrut}}%
      \settodepth\intmathmandepth{\hbox{\tkzmathmandstrut}}%
    }%
    {%
      \setlength\intmathmanheight{#3}%
    }%
  %colors
  \ifboolKV[tkzmathman]{bw}%
    {%
      \colorlet{tkzmathmanmouth}{gray}%
      \colorlet{tkzmathmancol}{darkgray}%
      \def\tkzmathmandbodycol{}%
    }%
    {%
      \colorlet{tkzmathmanmouth}{red!25!orange}%
    }%
  \ifthenelse{\equal{\tkzmathmandbodycol}{}}%
   {%
      \def\intmathmanscale{\fpeval{\intmathmanheight/6.5595cm}}%
   }%
   {%
      \def\intmathmanscale{\fpeval{\intmathmanheight/6.8595cm}}%
   }%
  \intpictotestdautolen{#3}%
    {%
      \setlength\intmathmandepth{-\intmathmandepth}%
      \raisebox{\intmathmandepth}{%
        \begin{tikzpicture}[scale=\intmathmanscale,line width=\fpeval{\intmathmanscale*2mm},line cap=round, line join=round,#2]
          \inttkzmathman{#4}
        \end{tikzpicture}%
      }%
    }%
    {%
      \begin{tikzpicture}[scale=\intmathmanscale,line width=\fpeval{\intmathmanscale*2mm},line cap=round, line join=round,#2]
        \inttkzmathman{#4}
      \end{tikzpicture}%
    }%
}

\endinput