What we are talking about is a coating property called, appropriately, "hide." It varies from pigment to pigment, and it also varies from paint to paint, depending on how much pigment (called pigment load) is put into a formulation. How much pigment there is in a formulation is related to, among many other things, the weight of the pigment. There are also "colorless" pigments that are added strictly to improve hide. More on those, later.
The ability of a pigment to provide opacity is related to its particle size, particle shape, translucency, and an odd property called internal reflection that is related to translucency. The worst pigment for hide is usually yellow. This was not true prior to the 1960's, when chromate pigments (highly toxic) were still in use. Modern yellow pigments often have a very small particle size and are fairly equant in dimension. IIRC, they are also relatively heavy and translucent, with low internal reflection. As a result, the amount of yellow pigment that can be put in a paint is relatively low, and its ability to reflect light is relatively poor.
White is only a little better. It is quite heavy. One form of the pigment has a tabular shape, the other is roughly equant. The tabular pigment gets used in flat white. Because the particles are tabular, they tend to settle flat and present a wide, flat surface to incident light. That is one reason why flat whites generally have better hide than gloss whites. Another is that gloss whites have lower pigment loads than flats. This is necessary because high pigment loads reduce gloss, which is produced by the binder. This is true of all paint colors: for a given color of a given brand of paint, the flat will have better hide, all other things being equal.
White pigment also has high internal reflection. This helps the brightness, and slightly improves hide.
White paints often include essentially colorless pigments intended to improve hide. This is possible with white because of the high internal reflectance of the white pigment. Yellow, having lower internal reflectance, will become dull at the same opacity pigment load as a white.
Pigments with the best hide are opaque and tabular. That is why metallics and black generally have such good hide. All metallic pigments (with some specialty coating exceptions) are tabular. The primary pigment in black is a form of graphite‚—also tabular and very opaque.
That's the barest bones of it. I could go on, but I can hear your eyes crossing even over the internet! (Those of you who haven't fallen asleep, that is.)