# Conditional Background Color

**URL:** <https://community.weweb.io/t/conditional-background-color/9764>\
**Category:** Ask us anything\
**Tags:** design\
**Created:** [July 17, 2024, 11:12am UTC](https://community.weweb.io/t/conditional-background-color/9764 "2024-07-17T11:12:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tris](https://avatars.discourse-cdn.com/v4/letter/t/49beb7/32.png) [@tris](https://community.weweb.io/u/tris)\
**Post date:** [July 17, 2024, 11:12am UTC](https://community.weweb.io/t/conditional-background-color/9764/1 "2024-07-17T11:12:24Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![andreas](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/andreas/32/7349_2.png) [@andreas](https://community.weweb.io/u/andreas)\
**Post date:** [July 19, 2024, 2:19pm UTC](https://community.weweb.io/t/conditional-background-color/9764/2 "2024-07-19T14:19:20Z")

</div>

You could use an external API like [Dominant Colors - Ximilar API](https://docs.ximilar.com/services/dominant_colors/) for this. There may be others (maybe free ones)
