I know this has been asked, but the answer form here: https://gist.github.com/tamask/2590850 doesn't work for me. I get an "out of range error" in the first loop. I tried modifying a solution from here: Vertices—loop indices vs. unique indices but nothing. Here's the code:
import bpy
from collections import defaultdict
obj = bpy.context.active_object
col = obj.data.vertex_colors.active
polygons = obj.data.polygons
color = (0, 1, 0, 0)
vertex_map = defaultdict(list)
for poly in polygons:
for v_ix, l_ix in zip(poly.vertices, poly.loop_indices):
vertex_map[v_ix].append(l_ix)
for v_ix, l_ixs in vertex_map.items():
for l_ix in l_ixs:
if col.data[l_ix].color == color:
obj.data.vertices[v_ix].select = True
I would really appreaciate any help.