Vary Color of Object Based on Object Dimensions (Size)
You're so close - you just need to swap one of your Math nodes for a Vector Math node, and the other for a MixRGB. Note the divide factor for the mix node is set to 1 (anything less covers less than the whole surface).  See below:

NOTE - The scale I had initially was too big, apparently, I had to scale all the objects down (except for the empty) to get it to look right, but I was working fast and carelessly. I'm sure it can look &quot;right&quot; at any scale, it may just have to be adjusted by adding a Map Range node between the MixRGB and the ColorRamp - Just connect the color output of the MixRGB to the value input of the Map Range.