The Mesh Paint tool relies on a pair of colors for it to work. Users may choose a Paint Color as well as an Erase Color and swap between them at any time. Color selections are made by way of a standard Color Picker window.

For workflow purposes, it will be easier to think of the Erase Color as an alternate paint color. Using the Erase Color does not remove your previous strokes like using the Eraser Tool in Photoshop or a similar image editing software. Instead, you are just painting with a different color. As an example, if your base is white then you would use white as your Erase color.
While using the Mesh Paint panel, you can also click the Swap icon to reverse the Paint and Erase colors. This is especially handy when you need to quickly jump back and forth between a pair of colors, or do a fast touch-up on a misplaced brush stroke.
You can also use the Reset icon to return to the default the Paint and Erase colors, either for all 4 channels (RGBA) at once or individually. The Paint channel default is white (1, 1, 1, 1), the Erase channel default is black (0, 0, 0, 1).

Swap icon and Reset icon
Clicking on Swap Colors in the Modes Toolbar has the same function as the Swap icon in the Mesh Paint panel.

Remember that the Color Picker has a variety of ways to quickly select colors, including saving color swatches and setting up color themes. Please see the Color Picker documentation for details.