How to set Node's group color via Python? Could you tell me how to Node's group color via Python?
Something like this:




class AddButton(bpy.types.Operator):
bl_idname = "add.button"
bl_label = "Add PBR Group"

def execute(self, context):
    mat = bpy.data.materials.new('zheight')
    mat.use_nodes = True
    nodes = mat.node_tree.nodes
   # print("execute") 
   # print(self.filepath) # /home/addajr/Grafika/3D/textury/metal.jpg
    obj = bpy.context.object
    # change on cycles
    bpy.context.scene.render.engine = 'CYCLES'
    #Add a material slot
    bpy.ops.object.material_slot_add()
    #Assign a material to the last slot
    obj.material_slots[obj.material_slots.__len__() - 1].material = MakeMaterial_1()    

    ############ color ############  
    C = bpy.context
    D = bpy.data

    compTree = C.scene.node_tree                   # Compositing node tree
    matTree  = D.materials[ mat.name ].node_tree # 'MyMaterial' material node tree

    t = matTree # For this example we'll use the compositing node tree    


    ##########   add custom nodes ########     
    nodes = mat.node_tree.nodes
    group = bpy.data.node_groups.new(type="ShaderNodeTree", name="PBR")
    print( group.name )

    .
    .
    .
    .
    tree = bpy.context.object.active_material.node_tree
    group_node = tree.nodes.new("ShaderNodeGroup")
    group_node.node_tree = group

    # Turn on custom color
    t.nodes[ group.name ].use_custom_color = True
    t.nodes[ group.name ].color = ( 1, 0.711485, 0.137081 )

    glossinessFactorInput = bpy.data.node_groups[ group.name ].inputs['Glossiness Factor']

    glossinessFactorInput.min_value     = -5.0
    glossinessFactorInput.max_value     = 5.0
    glossinessFactorInput.default_value = 1.5          
    return {"FINISHED"}
A node group is also a node, so you set the node group's color the same way you do any other node:

import bpy
C = bpy.context
D = bpy.data

compTree = C.scene.node_tree                   # Compositing node tree
matTree  = D.materials['MyMaterial'].node_tree # 'MyMaterial' material node tree

t = compTree # For this example we'll use the compositing node tree

groupName = 'Group'

# Turn on custom color
t.nodes[ groupName ].use_custom_color = True

# Set group's color to pink
t.nodes[ groupName ].color = ( 0.5, 0.2, 0.75 )