As far as I know there is no simple way to get the color of a particle. In the case you have an object with UV's and 1 image texture defining the color you should be able to get the color.
The following example is for BI and assumes you only have 1 UV map, the texture is in slot 1 and there is only 1 particle system and 1 modifier (the modifier for the particle system) on the object.
from mathutils import Color
def get_pixel_color(img, x, y):
# Get the 'index' of the pixel. Pixels are stored as one big list of
# numbers. The R, G, B and A value for every pixel, one after the other.
pixel_i = y * img.size * 4 + x * 4
pixel_col = img.pixels[pixel_i:pixel_i + 4]
# Return the color as Color object, which doesn't have alpha info.
def get_uv_color(img, uv):
# Get the x and y coordinates of the pixel for the given uv coordinate.
pixel_x = int(uv.x * img.size)
pixel_y = int(uv.y * img.size)
uv_col = get_pixel_color(img, pixel_x, pixel_y)
def get_particle_color(p, ps, ps_mod):
p_uv = ps.uv_on_emitter(ps_mod, p)
p_mat = bpy.data.materials[ps.settings.material_slot]
p_mat_tex = p_mat.texture_slots.texture
p_mat_img = p_mat_tex.image
p_col = get_uv_color(p_mat_img, p_uv)
obj = bpy.context.object # The object with the particle system
ps = obj.particle_systems # The particle system you need to query
ps_mod = obj.modifiers # The modifier for the particle system
p = ps.particles # The first particle
p_col = get_particle_color(p, ps, ps_mod)
For Cycles (assuming that there is only 1 Image Texture node in the Shading Node Tree) you should change the
get_particle_color function. The statement for
p_mat_tex should be changed to:
p_mat_tex = p_mat.node_tree.nodes['Image Texture']