Switch editor mode to Meshpaint

How can one switch the Editor to Meshpaint mode? And how can one set the paint color and mask settings of the mesh paint tool programmatically?

The console command MODE MESHPAINT does not do anything in the console. However, that’s listed as a command to switch the editor mode to Meshpaint in the documentation.