I'm trying to make a personal cheatsheet for keyboard shortcuts in (mostly) sublime text and openbox (linux window manager). I found this beautiful template:
https://gist.github.com/alexander-yakushev/c773543bf9a957749f79
that does almost everything I'd like it to, except that it would be very useful to be able to color the different key-sections in different colors. I think the key is in the definition of the key enviroment in line 73-94 here:
\NewEnviron{keys}[1]{
% \begin{center}
\smallskip
\begin{tikzpicture}
\rowcolors{1}{}{TableRow}
\centering
\node (tbl) [inner sep=0pt] {
\begin{tabular}{p{4.2cm}p{3.25cm}}
\rowcolor{TableHead}
\multicolumn{2}{l}{\normalsize\textbf{\color{white}{#1}}}\parbox{0pt}{\rule{0pt}{0.3ex+\baselineskip}}\\
\BODY
\arrayrulecolor{TableHead}\specialrule{.17em}{0em}{.2em}
\end{tabular}};
\begin{pgfonlayer}{background}
\draw[rounded corners=2pt,top color=TableHead,bottom color=TableHead, draw=white]
($(tbl.north west)-(0,-0.05)$) rectangle ($(tbl.north east)-(0.0,0.15)$);
\draw[rounded corners=2pt,top color=TableHead,bottom color=TableHead, draw=white]
($(tbl.south west)-(0.0,-0.11)$) rectangle ($(tbl.south east)-(-0.0,-0.02)$);
\end{pgfonlayer}
\end{tikzpicture}
% \end{center}
}
I'm not good enough in latex to figure this out, however. Ideally, the key-command defined should have another argument so that:
\begin{keys}{Glossary}
Control (Ctrl) key & \texttt{C} \\
Alt (Meta) key & \texttt{M} \\
Shift key & \texttt{S} \\
Command (Super) key & \texttt{CMD} \\
Function (Fn) key & \texttt{fn} \\
Home/end & \texttt{fn-left / fn-right} \\
\end{keys}
would be something like:
\begin{keys}{Glossary}{purple}
Control (Ctrl) key & \texttt{C} \\
Alt (Meta) key & \texttt{M} \\
Shift key & \texttt{S} \\
Command (Super) key & \texttt{CMD} \\
Function (Fn) key & \texttt{fn} \\
Home/end & \texttt{fn-left / fn-right} \\
\end{keys}
so that the color of the section could be defined
below is an illustration of the pdf output from the template, annotated with color in order to make it even clearer.
Thank you for your time,