\documentclass{minimal}
\usepackage{amsmath}
\usepackage[active,tightpage]{preview}
\setlength\PreviewBorder{1pt}
\usepackage{pgf}
\usepackage{tikz}
\usepgfmodule{plot}
\usepgflibrary{plothandlers}
\usetikzlibrary{shapes.geometric}
\usetikzlibrary{shadings}
\begin{document}
\begin{preview}
\begin{tikzpicture}[every node/.style={draw,scale=1pt,
minimum width=20pt,inner sep=3pt,
line width=0pt,draw=black}]
\matrix[row sep=2pt,column sep=2pt]
{\node[]{21};&
\node[]{22};&
\node[]{23};&
\node[]{24};&
\node[]{25};&
\node[]{26};&
\node[]{27};&
\node[]{28};&
\node[]{29};&
\node[fill=red]{30};&
\node[]{31};&
\node[]{32};&
\node[]{33};&
\node[]{34};&
\node[]{35};&
\node[]{36};&
\node[]{37};&
\node[]{38};&
\node[]{39};&
\node[fill=green]{40};\\
\node[left color=red,right color=green]{1};&
\node[left color=red,right color=green]{2};&
\node[fill=red]{3};&
\node[fill=green]{4};&
\node[left color=red,right color=green]{5};&
\node[fill=red]{6};&
\node[]{7};&
\node[fill=green]{8};&
\node[]{9};&
\node[left color=red,right color=green]{10};&
\node[]{11};&
\node[]{12};&
\node[]{13};&
\node[]{14};&
\node[fill=red]{15};&
\node[]{16};&
\node[]{17};&
\node[]{18};&
\node[]{19};&
\node[fill=green]{20};\\
};
\end{tikzpicture}
\end{preview}
\end{document}