js/src/serialize.js
function string_array_to_rgb(string_array) {
        var rgbs = new Float32Array(string_array.length * 3);
        for (var i = 0; i < string_array.length; i++) {
            var color = new THREE.Color(string_array[i]);
            rgbs[i * 3 + 0] = color.r;
            rgbs[i * 3 + 1] = color.g;
            rgbs[i * 3 + 2] = color.b;
        }
        return rgbs;
    }
function string_array_to_rgb(string_array) {
        var rgbs = new Float32Array(string_array.length * 3);
        for (var i = 0; i < string_array.length; i++) {
            var color = new THREE.Color(string_array[i]);
            rgbs[i * 3 + 0] = color.r;
            rgbs[i * 3 + 1] = color.g;
            rgbs[i * 3 + 2] = color.b;
        }
        return rgbs;
    }
It can deals with these 6 cases: which are threated in the same order shape is 0 dim, and it's a string, interpret as color shape is 1 dim, items are strings, seperate color for each item shape is 2 dim, items are strings, sequence of the above shape is 1 dim, items are floats, it should be of length 3 -> rgb values shape is 2 dim, items are float, it should be of shape (len(x), 3) -> rgb values shape is 3 dim, items are float, it should be (sequence_length, len(x), 3) -> rgb values