Many people have painted the foam, but I don't know what the long term outcome is.
Any time I've used insulative foam around the house, it goes brittle and falls apart about three years later. It seems to last if it isn't exposed to ultraviolet light.
Try an older foam thread and ask for an update on the condition of the foam after a few years in salt water with UV exposure and burrowing animals.
Two step epoxy or two step polyurethane paint would work best.