Add multiple colors to object when stl file loaded

I’m trying to put several colors to one stl file when it’s loaded…
however when stl file exported, it doesn’t contains colors so i tried to put several materials to the object as an array but it doesn’t work. I’m new to this and i haven’t found the solution yet.
some says use plyloader and some says vertex colors but still haven’t figure it out.
Is there any way to put multiple colors to object which is loaded by STLLoader?

STL has no material support so adding materials in your three.js app has no effect.

Vertex colors are not support by default in STL. However, there are non-standard variations on the binary STL format for adding color information (see STL (file format) - Wikipedia). STLLoader supports the Magics approach however STLExporter does not.

To sum up: STL is not a good choice if you need vertex color. If possible, use glTF otherwise try it with PLY. Both loaders and exporters support vertex colors.