STL is a pure geometry format. Meaning it does not support any material information.
However, it does support vertex colors. Depending on the STL exporter, the color might be decoded as vertex colors in the geometry. Fortunately, THREE.STLLoader
does parse vertex colors and provides a flag for testing. Use this approach in your onLoad()
callback:
if ( geometry.hasColors === true ) {
material = new THREE.MeshPhongMaterial( { vertexColors: true } );
}