Quannfield theory really matters here. That's one thing. The other thing is the extra energy. If you had a lone quark all by itself, the energy in the gluon field around it would be infinitely big. However, if you have three quarks, all of different colors, then, just like the electron and the proton, the fields cant out at infinity. There's more energy and therefore more mass ther there's a contribution to the massf of the particle from its electric field.
Welcome to the September 2021 Ask Me Anything episode of Mindscape! These monthly excursions are funded by Patreon supporters (who are also the ones asking the questions). I take the large number of questions asked by Patreons, whittle them down to a more manageable size — based primarily on whether I have anything interesting to say about them, not whether the questions themselves are good — and sometimes group them together if they are about a similar topic. Enjoy!
See Privacy Policy at https://art19.com/privacy and California Privacy Notice at https://art19.com/privacy#do-not-sell-my-info.