def ply_save_color_face(path, verts, faces, colors):
    """
  Save mesh into a .ply file with colored faces.

  Parameters
  ----------
  path : str
    Path to save the file.
  verts : np.ndarray, shape [v, 3]
    Mesh vertices.
  faces : np.ndarray, shape [f, 3]
    Mesh faces.
  colors : np.ndarray, shape [f, 3], dtype uint8
    RGB color for each face.
  """
    num_verts = verts.shape[0]
    num_faces = faces.shape[0]
    with open(path, 'wb') as f:
        f.write(b'ply\n')
        f.write(b'format ascii 1.0\n')
        f.write(b'element vertex %d\n' % num_verts)
        f.write(b'property float32 x\n')
        f.write(b'property float32 y\n')
        f.write(b'property float32 z\n')
        f.write(b'element face %d\n' % num_faces)
        f.write(b'property list uint8 int32 vertex_index\n')
        f.write(b'property uchar red\n')
        f.write(b'property uchar green\n')
        f.write(b'property uchar blue\n')
        f.write(b'end_header\n')
        for i in range(num_verts):
            v = verts[i]
            f.write(b'%f %f %f\n' % (v[0], v[1], v[2]))
        for i in range(num_faces):
            face = faces[i]
            c = colors[i]
            f.write(b'3 %d %d %d %d %d %d\n' % (face[0], face[1], face[2],
                c[0], c[1], c[2]))
