This is not advised.  Painting the foam will block the open cells and render the foam useless.  If you would prefer to have acoustic treatment with colour then our fabric wrapped acoustic panels are a popular option.