I borrowed code from @David Carlisle's answer to this question. It defines counters for rows and columns of an array, and I just had to test the value of the sum of these counters to choose the colour of a given cell. I defined a new column type to simplify the typing of the table:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{fourier, erewhon}
\usepackage{blkarray}%
\usepackage[table]{xcolor}
\colorlet{ccol1}{red}
\colorlet{ccol2}{yellow}
\colorlet{ccol3}{cyan}
\colorlet{ccol4}{green}
\colorlet{ccol5}{brown}
\colorlet{ccol6}{magenta}
\colorlet{ccol7}{orange}
\colorlet{ccol8}{lime!80!}
\colorlet{ccol9}{pink}
\colorlet{ccol10}{violet!50!}
\colorlet{ccol11}{olive!50!}
%%%% Code by David Carlisle
\makeatletter
\def\insert@column{%
\the@toks \the \@tempcnta
\global\advance\c@tabcol\@ne
\ignorespaces \@sharp \unskip
\the@toks \the \count@ \relax}
\let\old@arraycr\@arraycr
\def\@arraycr{\global\c@tabcol\z@\global\advance\c@tabrow\@ne\old@arraycr}
\let\old@tabarray\@tabarray
\def\@tabarray{\global\c@tabrow\@ne\global\c@tabcol\z@\old@tabarray}
\makeatother
\newcounter{tabcol}\newcounter{tabrow}
%%%%%%%%%%%%%%%
\newcounter{diagctr}
\newcolumntype{C}{>{\setcounter{diagctr}{\numexpr \value{tabrow} + \value{tabcol}\relax}\cellcolor{ccol\arabic{diagctr}}}c}
\begin{document}
\[\renewcommand\arraystretch{1.5}
\begin{array}{*{6}{C}}%
e & a & a^2 & a^3 & a^4 & a^5 \\
a & a^2 & a^ 3 & a^4 & a^5 & e \\
a^2 & a^3 & a^4 & a^5 & e & a \\
a^3 & a^4 & a^5 & e & a & a^2 \\
a^4 & a^5 & e & a & a^2 & a^3 \\
a^5 & e & a & a^2 & a^3 & a^4
\end{array}
\]
\end{document}

If one wants to add an uncoloured row above, or a column on the left or both, one must change the formula which defines the index of the colour and add a test to determine if \cellcolor must be added on entering the cell or not. This is done with the help of etoolbox:
\usepackage{etoolbox}
\newcounter{diagctr}
\newcolumntype{C}{>{\setcounter{diagctr}{\numexpr \value{tabrow} + \value{tabcol}-2\relax}%
\ifboolexpr{test {\ifnumequal{\value{tabcol}}{0}} or test {\ifnumequal{\value{tabrow}}{1}}}{\relax}{\cellcolor{ccol\arabic{diagctr}}}}%
c}
\[\renewcommand\arraystretch{1.5}
\renewcommand\arrayrulewidth{2pt}
\begin{array}{C*{6}{C}}
& e & a & a^2 & a^3 & a^4 & a^5\\
\cline {2-7}\noalign{\vskip2pt}
e & e & a & a^2 & a^3 & a^4 & a^5 \\
a & a & a^2 & a^ 3 & a^4 & a^5 & e \\
a^2 & a^2 & a^3 & a^4 & a^5 & e & a \\
a^3 & a^3 & a^4 & a^5 & e & a & a^2 \\
a^4 & a^4 & a^5 & e & a & a^2 & a^3 \\
a^5 & a^5 & e & a & a^2 & a^3 & a^4\\
\cline {2-7}
\end{array}
\]
\end{document}
