Rendered object color different from viewport color, set in Python I'm using Blender 2.80. Start in a new scene with no objects. Add a sphere, then go to the Properties panel, Material tab, and set the Base color to pure red in the Principled BSDF. Next, run this script:

    import bpy

    # Get current active object
    ob = bpy.context.active_object

    # Set the material diffuse color
    ob.material_slots[0].material.diffuse_color = (0.0, 0.0, 1.0, 1.0)


When I do this, the color of the sphere changes to blue in the viewport. However if I do a render with F12, the color of the sphere is still red. How can I set the material color for rendered images?
You are changing the viewport setting instead of node value.

NodeSocketColor

Use ob.material_slots[0].material.node_tree.nodes[1].inputs['Base Color'].default_value = (0,0,0,0)