I prefer painting the foam before glassing, but be careful of the paint you use. Water based paints are far less problematic to glass over, but I think most rattle cans have oil based paint, and there can be issues, so do some tests first.
Since a chess board pattern is a very simple pattern to achieve with a masking and a foam roller, you might also consider rolling it with acrylic or latex paint. Maybe Barry Snyder will chime in, he has a lot of experience with painting blanks.
Also, try a search of the archives for painting foam before glassing, lots of boards in the past have been done with this method. Just click the search icon at the top (magnifying glass) and type in “painting foam before glassing” or “painting foam blank” and you’ll get links to past threads.