%!TEX pdflatex

\documentclass{article}
\usepackage[margin=1cm,a4paper]{geometry}
\usepackage{calc,graphicx,simplekv,xstring}
\usepackage{tikz}
\usepackage{codehigh}
\setlength\parindent{0pt}

\newlength\tmptotalheightcurrenttext
\newlength\tmpdepthcurrenttext

\defKV[minictikzcalendar]{%
	Couleur=\def\minictikzcalendarcol{#1},%
	Hauteur=\def\minictikzcalendarheight{#1},%
	CouleurMois=\def\minictikzcalendarcolmois{#1},%
	CouleurJour=\def\minictikzcalendarcoljour{#1}
}
\setKVdefault[minictikzcalendar]{%
	Couleur=black,%
	Hauteur=dauto,%
	CouleurMois=white,%
	CouleurJour=black
}

\tikzset{minicalmois/.style={font=\sffamily\bfseries,\minictikzcalendarcolmois}}
\tikzset{minicaljour/.style={font=\sffamily\bfseries,\minictikzcalendarcoljour}}

\NewDocumentCommand\MiniDateCalendrier{ O{} m m }{%
	\restoreKV[minictikzcalendar]%
	\setKV[minictikzcalendar]{#1}%
	\IfStrEqCase{\minictikzcalendarheight}{%
		{auto}%
		{%
			\settototalheight\tmptotalheightcurrenttext{\hbox{M}}%
			\tikzset{minicaldepth/.style={x=0.975\tmptotalheightcurrenttext,y=0.975\tmptotalheightcurrenttext}}%
		}%
		{dauto}%
		{%
			\settototalheight\tmptotalheightcurrenttext{\hbox{qM}}%
			\settodepth\tmpdepthcurrenttext{\hbox{qM}}%
			\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]
		\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,minicalmois] {\resizebox{!}{0.175\tmptotalheightcurrenttext}{\vphantom{JanvierFevrierMarsAvrilMaiJuinJuilletAoutSeptembreOctobreNovembreDecembre}#3}} ;
		\draw[black] (0.5,0.35) node[inner sep=0pt,minicaljour] {\resizebox{!}{0.425\tmptotalheightcurrenttext}{\vphantom{0123456789}#2}} ;
	\end{tikzpicture}%
}

\begin{document}

\begin{demohigh}[language=latex/latex2]
%défaut := hauteur 'complète' avec jambage
q\MiniDateCalendrier{15}{août}M\\
{\huge q\MiniDateCalendrier{15}{août}M}
\end{demohigh}

\begin{demohigh}[language=latex/latex2]
%défaut := hauteur 'simple' sans jambage
q\MiniDateCalendrier[Hauteur=auto]{15}{août}M\\
{\huge q\MiniDateCalendrier[Hauteur=auto]{15}{août}M}
\end{demohigh}

\begin{demohigh}[language=latex/latex2]
%avec couleur(s)
q\MiniDateCalendrier[Couleur=violet]{15}{août}M\\
{\huge q\MiniDateCalendrier[Couleur=yellow!50!orange,CouleurMois=black,CouleurJour=black]{15}{août}M}
\end{demohigh}

\foreach \i in {01,02,03,04,XX,28,29,30,31}{%
	\Huge\MiniDateCalendrier[Couleur=red]{\i}{janv.}\relax
}\par
\foreach \i in {01,02,03,04,XX,26,27,28,29}{%
	\Huge\MiniDateCalendrier[Couleur=blue]{\i}{fév.}\relax
}\par
\foreach \i in {01,02,03,04,XX,28,29,30,31}{%
	\Huge\MiniDateCalendrier[Couleur=olive]{\i}{mars}\relax
}\par
\foreach \i in {01,02,03,04,XX,27,28,29,30}{%
	\Huge\MiniDateCalendrier[Couleur=blue]{\i}{avr.}\relax
}\par
\foreach \i in {01,02,03,04,XX,28,29,30,31}{%
	\Huge\MiniDateCalendrier[Couleur=brown]{\i}{mai}\relax
}\par
\foreach \i in {01,02,03,04,XX,27,28,29,30}{%
	\Huge\MiniDateCalendrier[Couleur=orange]{\i}{juin}\relax
}\par
\foreach \i in {01,02,03,04,XX,28,29,30,31}{%
	\Huge\MiniDateCalendrier[Couleur=lime,CouleurMois=black]{\i}{juil.}\relax
}\par
\foreach \i in {01,02,03,04,XX,28,29,30,31}{%
	\Huge\MiniDateCalendrier[Couleur=pink,CouleurMois=black]{\i}{août}\relax
}\par
\foreach \i in {01,02,03,04,XX,27,28,29,30}{%
	\Huge\MiniDateCalendrier[Couleur=teal]{\i}{sept.}\relax
}\par
\foreach \i in {01,02,03,04,XX,28,29,30,31}{%
	\Huge\MiniDateCalendrier[Couleur=gray]{\i}{oct.}\relax
}\par
\foreach \i in {01,02,03,04,XX,27,28,29,30}{%
	\Huge\MiniDateCalendrier[Couleur=yellow,CouleurMois=black]{\i}{nov.}\relax
}\par
\foreach \i in {01,02,03,04,XX,28,29,30,31}{%
	\Huge\MiniDateCalendrier[Couleur=magenta]{\i}{déc.}\relax
}\par

\end{document}
