Auto Run Python Script from Text window
Requirements for auto running a script.

Press CTRL+ALT+U
to open user prefernces.

In the File tab ensure Auto Execution is checked.

Save User settings.

In Text editor:
Create new text block.

Copy script into new text block (ensure the script has an explicit register function note bottom lines).

Save text block as cp.py. Unlink text block. Open cp.py.

Click Register checkbox.

Save Blend file
Close Blend file
re-Open Blend file ... panel should auto run.

import bpy
from bpy.types import Panel


class ExamplePanel(Panel):
    bl_label = "Background Colours"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'

    def draw(self, context):
        layout = self.layout
        obj_types = ['MESH', ]  # add types as needed
        objs = [obj for obj in bpy.data.objects if
                obj.type in obj_types and obj.select]
        col_types = ['RGBA', ]  # add types as needed
        for obj in objs:
            box = layout.box()
            box.label(obj.name)
            # for viewport or non node colors
            if obj.active_material:
                my_mat = [mat for mat in bpy.data.materials if
                          mat.name == obj.active_material.name]
                box.label("Viewport Color")
                box.prop(my_mat[0], "diffuse_color", text="")
            else:
                box.label("Requires active material")
            # for materials using shader nodes
            if my_mat[0].use_nodes:
                my_nodes = [nd for nd in my_mat[0].node_tree.nodes]
                box = box.box()
                box.label("Render color")
                for node in my_nodes:
                    for ip in node.inputs:
                        if ip.type in col_types:
                            box.prop(ip, "default_value", text=("%s: %s" % (node.type, ip.name)))

classes = [ExamplePanel, ]


def register():
    for cls in classes:
        bpy.utils.register_class(cls)


def unregister():
    for cls in classes:
        bpy.utils.unregister_class(cls)


#if __name__ == "__main__":  # only for live edit.
#    register()

register()  # required for autorun