If you have glass doors you may want the inside box to match the exterior colour of the cabinets.
However, if your cupboards are laminated with a durable white vinyl surface, it's usually unnecessary to paint them.
If they are dirty you can usually clean then up with a mild soap or something similar to Spray Nice.
Image
Image