How to add custom color picker in blender material panel?

I would like to add a custom colour picker for a custom material section. The colour picker should be below the red line in the image:


Final result should be like this:


Some info about the new colour picker:

  1. It should have name as “Detail Color”
  2. Color size: 4
  3. Default color: white (1.0,1.0,1.0,1.0)

I came across some coding from other websites but it doesn’t allow me to position at my desired location. Hope if someone can create a new code or alter this code:


import bpy

class POSE_PT_test(bpy.types.Panel):    bl_label = "Test"
    bl_space_type = 'VIEW_3D'
    bl_region_type = 'TOOLS'
    bl_category = "Testing"

    @classmethod
    def poll(self, context):
            return True

    def draw(self, context):
            self.layout.prop(context.scene, "test_color", text='Detail Color')


    def register():
            bpy.utils.register_class(POSE_PT_test)
            bpy.types.Scene.test_color = bpy.props.FloatVectorProperty(
                                 name = "myColor",
                                 subtype = "COLOR",
                                 size = 4,
                                 min = 0.0,
                                 max = 1.0,
                                 default = (1.0,1.0,1.0,1.0)
                                 )

    register()

Thank you in advance .

Manochvarma Raman

Jayanam mention about this in his python tutorial please check in YouTube

Will check it, thank you