%!TEX pdflatex

\documentclass{article}
\usepackage[margin=5mm,a5paper]{geometry}
\usepackage{tikz}
\usepackage{xintexpr}
\usepackage{xstring}
\usepackage{calc}
\usepackage{simplekv}

%====pictoskills
\newcommand\samplecapletters{AZERTYUIOSDFHKLMWXCVBN}
\newcommand\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]{%
	col=\def\pictoskillcol{#1},%
	height=\def\pictoskillh{#1},%
	hoffset=\def\pictoskilloffset{#1},%
	opacity=\def\pictoskillopacity{#1}
}
\setKVdefault[pictoskill]{%
	col=skillgreen,%
	height=auto,%
	hoffset=0.0375,%
	opacity=0.5
}

\NewDocumentCommand\pictoskill{ O{} m }{%
	\restoreKV[pictoskill]%
	\setKV[pictoskill]{#1}%
	%levels + opacity
	\xintifboolexpr{#2 > 3}{\def\pictoskilllevel{1}}{\def\pictoskilllevel{#2}}%
	\xdef\pictoskillopacity{\xintfloateval{100*\pictoskillopacity}}%
	%height
	\IfStrEqCase{\pictoskillh}{%
		{auto}%
		{%
			\settototalheight{\pictoskillheight}{\hbox{\samplecapletters}}%
			\settodepth{\pictoskilldepth}{\hbox{\samplecapletters}}%
			\begin{tikzpicture}[x=1.125\pictoskillheight,y=0.975\pictoskillheight]%
			}%
			{dauto}%
			{%
				\settototalheight{\pictoskillheight}{\hbox{\sampledptletters\samplecapletters}}%
				\settodepth{\pictoskilldepth}{\hbox{\sampledptletters}}%
				\begin{tikzpicture}[x=1.125\pictoskillheight,y=0.975\pictoskillheight,baseline=0.975\pictoskilldepth]%
				}%
			}[%
			\setlength\pictoskillheight{\pictoskillh}%
			\setlength\pictoskilldepth{0pt}%
			\begin{tikzpicture}[x=1.125\pictoskillheight,y=0.975\pictoskillheight]%
			]%
	\clip (\pictoskilloffset,0)--++(0,0.6)--({1-\pictoskilloffset},1)--({1-\pictoskilloffset},0)--cycle;
	\IfStrEqCase{\pictoskilllevel}{%
		{0}%
		{%
			\filldraw[very thin,\pictoskillcol!\pictoskillopacity!white] (\pictoskilloffset,0) rectangle ({1/3-\pictoskilloffset},1) ;
			\filldraw[very thin,\pictoskillcol!\pictoskillopacity!white] ({1/3+\pictoskilloffset},0) rectangle ({2/3-\pictoskilloffset},1) ;
			\filldraw[very thin,\pictoskillcol!\pictoskillopacity!white] ({2/3+\pictoskilloffset},0) rectangle ({3/3-\pictoskilloffset},1) ;
		}%
		{1}%
		{%
			\filldraw[very thin,\pictoskillcol] (\pictoskilloffset,0) rectangle ({1/3-\pictoskilloffset},1) ;
			\filldraw[very thin,\pictoskillcol!\pictoskillopacity!white] ({1/3+\pictoskilloffset},0) rectangle ({2/3-\pictoskilloffset},1) ;
			\filldraw[very thin,\pictoskillcol!\pictoskillopacity!white] ({2/3+\pictoskilloffset},0) rectangle ({3/3-\pictoskilloffset},1) ;
		}%
		{2}%
		{%
			\filldraw[very thin,\pictoskillcol] (\pictoskilloffset,0) rectangle ({1/3-\pictoskilloffset},1) ;
			\filldraw[very thin,\pictoskillcol] ({1/3+\pictoskilloffset},0) rectangle ({2/3-\pictoskilloffset},1) ;
			\filldraw[very thin,\pictoskillcol!\pictoskillopacity!white] ({2/3+\pictoskilloffset},0) rectangle ({3/3-\pictoskilloffset},1) ;
		}%
		{3}%
		{%
			\filldraw[very thin,\pictoskillcol] (\pictoskilloffset,0) rectangle ({1/3-\pictoskilloffset},1) ;
			\filldraw[very thin,\pictoskillcol] ({1/3+\pictoskilloffset},0) rectangle ({2/3-\pictoskilloffset},1) ;
			\filldraw[very thin,\pictoskillcol] ({2/3+\pictoskilloffset},0) rectangle ({3/3-\pictoskilloffset},1) ;
		}%
	}%
	\end{tikzpicture}%
}

\begin{document}

{\Large\sffamily\pictoskill[]{1}\,Exercice n°1}

bla

\bigskip

{\Large\sffamily\pictoskill[col=skillorange]{2}\,Exercice n°2}

bla

\bigskip

{\Large\sffamily\pictoskill[col=skillred]{3}\,Exercice n°3}

bla

\end{document}