OSL and MetaBalls

Hi guys, I have some scripting and programming experience, but I’m fairly new to OSL. I was wondering if it would be possible to control the color of a family of metaballs, maybe based on their position. To give each Metaball a specific color with a nice blend when they interact with each other.

Something like the Maya blobby particles:

I’ve achieved different metaball colors before by placing a pointlight inside of the metaball object, which illuminates the metaball, but it would be nice to use a regular diffuse shader.