Suppose we have a matrix of numbers
$$\begin{matrix} 1 & 3 & 2 & 4 \\ 1 & 2 & 3 & 4 \\ 1 & 2 & 3 & 4 \\ \end{matrix}$$
I would like to transform in MathJax a matrix of numbers into the matrix where entries are color squares. The example of this could be the text below (visible as the final effect)
$$\begin{matrix} \color{red}\blacksquare \color{teal}\blacksquare \color{#0F0}\blacksquare \color{blue}\blacksquare \\ \color{red}\blacksquare \color{#0F0}\blacksquare \color{teal}\blacksquare \color{blue}\blacksquare \\ \color{red}\blacksquare \color{#0F0}\blacksquare \color{teal}\blacksquare \color{blue}\blacksquare \\ \end{matrix}$$
however it has a drawback that it has inserted vertical and horizontal spaces between squares. Mapping between integer numbers and colors is fixed.
- How to do it without additional spacing? (to obtain continuous rectangular color area - at least to remove spacing between lines)
The solution is possible in Latex, but how to obtain similar result only in MathJAx?