Conditional Background Color

Hey there! Hope everyone is doing good.

I just had a quick question - would it be possible to change the background color of a section on my page depending on the primary colors that have been extracted from an image uploaded by the user.

The flow should be:

  1. User uploads image using my upload component
  2. Simple JS to get the 2 main colors from the uploaded image
  3. Bind these colors to that of the background of the section on the page.

Is this too complicated? I assume it cannot be done without custom code. Does anyone have any tips as to how to make this seamless?

Thank you so much guys!

You could use an external API like Dominant Colors - Ximilar API for this. There may be others (maybe free ones)