How would I change a Cycles material's color using the scale of the object instance it's applied to?
Cycles Sample 01



Cycles Sample 02



Consider a particle system and material shader nodes.

Use the particle info node size [relative scale] value.

Note the object particles with [size] set to 1 and [random size] set to 1 in the image below.


We assume that your placement of spheres can use a particle system.
Particles are emitted in 2 frames.  Of course with a more complex mesh particles can be placed anywhere.  There was no artistry in placement of the example I provided.  You can do better.

Below same Material with different Particles Settings. A more controlled placement with particles spaced evenly.