It sounds like what you are doing is pretty much what the standard color recognition code does. It uses weighted values (that are built into the sensor and are calibrated by Lego, they are different for different instances of the sensor), for each of the RGB values and the background reading. I'm not sure if you have seen the actual code used by the standard driver (which is based on the code in the Lego firmware), but it is here:
http://lejos.svn.sourceforge.net/viewvc ... iew=markup
The code is a little tricky to follow, because we wanted to allow the linker to be able to strip the class away if it was not being used, but you may find it interesting...