You have done part of the job, the dragging of color squares.
Now you need to do the second part: altering the existing code to change the
color in the 3D scene
You need to know the RGB value of color squares, either through variables or
by reading the RGB value with the getPixel instruction. You also need to assign
this RGB value to the diffuse color of the model shader.
You could have this in a parent script or a behavior:
-- Handler called by your drag'n'drop behavior when the mouse is released
on dropped me
-- Use spriteSpaceToWorldSpace() with mouseH and mouseV
-- Use modelsUnderRay() to know what model you hover
-- Change the diffuse property of the shader
pTargetShader.diffuse = pRGBColor