Read this, I have answered this question several times and provided several examples so you can see.
Provided you only ever have a maximum of 4 colours on any one layer, you can print with as many colours total by being smart with colouring and swapping spools.