How can I use the CellularAutomaton function to create a 2D automaton using a custom function and k colors?

I understood from [this post][1] how to use custom rules for 1D automata.

I'm trying now to do that for 2D automata but I don't quite understand how CellularAutomaton is reacting to this.

I tried this to see what the general function gets:

    CellularAutomaton[{Print[#] &, {}, {1, 1}}, {{{1}}, 0}, 1]

And I see that I get a matrix representing, I assume, the possible cases for rules

[![enter image description here][2]][2]

Compare this to the 1D case

[![enter image description here][3]][3]

But I still don't completely understand how to interpret this matrix and how to use more colors.

My final goal is to create [this kind of cyclic automata][4] using the CellularAutomaton function

Any kind of help would be useful. Thanks


  [1]: http://stackoverflow.com/questions/11326620/create-a-new-cellular-automata-rule-in-mathematica
  [2]: https://i.sstatic.net/LBmMF.png
  [3]: https://i.sstatic.net/KrGHc.png
  [4]: https://www.math.ucdavis.edu/~gravner/papers/cca.pdf