Play with the colors in tha COLORS array. You should also try a combination which contains three consecutive yellow colors. I suspect that setting a color to one which has been previously set is not working; this is the issue in the brush.color case.
Not quite - or it is nob obvious to me.
I set the array to red,blue,red,blue,red,blue (and increased it to 6 elements)
This was fine
but
red,red,red,blue,blue,blue is not.
Only the FIRST occurrence works, the others are black.
so it became
red,BLACK,BLACK, blue,BLACK,BLACK
with the yellow ones, the SECOND occurrence was correct, but not the first
I'll attach these screenshot as well. The legend shows how it was intended
/Björn