What is a matproxy?

What is a matproxy? From what I can tell, they are “functions” of some sort that change the internal values of a certain material. But how do they work?

I know they are used in the changing of colors for the physgun/player model.

They can be called through Lua obviously, but only materials with specific code in the .vmt will work with them.

Here’s an example of the breen vmt:

And here’s where the material’s proxy color is set:

A material proxy is invoked per entity per material(given the material has a proxy) so you have the chance to adjust the material parameters per entity in an easy manner