how we choose gradient and flat colors for creatives based on the image used or attractive color?

Creating creatives for social media or blog,

we using gradient colors or flat colors for creatives.

My question is which is the correct way to do, based on the image we need to select the color or random colors we will pick.

My Answer:

In my view is I selected colors based on the image we used in the creative.