lib/js: add generateColorTable() and modify putSphere()