# Which bpy.data.objects option controls the color of the object's texture?

I have 784 cubes in my scene right now, and I can loop through all 784 of them by using

for i in range(784):
bpy.data.objects[i]


Each cube represents a pixel which is in grayscale color, a value between 0.0 to 1.0. I already have my colors extracted from a 2D grayscale image and now I just want to transfer the corresponding brightness value to the cubes. Basically, do:

bpy.data.objects[i].find_its_color_options.change_brightness_to(0.873)


and repeat for all 784 cubes. I am currently using blender 2.8 but I don't think this is going to be much different than 2.79.

Any help is appreciated!

If you use in bpy.data.objects.active_material.material.diffuse_color you can set the diffuse color, and there are some other properties that may be useful here and here