# How could we set a gradient using a formula?

**URL:** <https://community.weweb.io/t/how-could-we-set-a-gradient-using-a-formula/5731>\
**Category:** How do I?\
**Tags:** design\
**Created:** [December 5, 2023, 11:17am UTC](https://community.weweb.io/t/how-could-we-set-a-gradient-using-a-formula/5731 "2023-12-05T11:17:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wirajan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/wirajan/32/6438_2.png) [@Wirajan](https://community.weweb.io/u/Wirajan)\
**Post date:** [December 5, 2023, 11:17am UTC](https://community.weweb.io/t/how-could-we-set-a-gradient-using-a-formula/5731/1 "2023-12-05T11:17:12Z")

</div>

Hello, There!! I am searching to define a gradient background using a formula so that the gradient also changes along with the dark or light mode.

---

<div class="post-metadata">

**Author:** ![Broberto](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/broberto/32/5918_2.png) [@Broberto](https://community.weweb.io/u/Broberto)\
**Post date:** [December 5, 2023, 11:41am UTC](https://community.weweb.io/t/how-could-we-set-a-gradient-using-a-formula/5731/2 "2023-12-05T11:41:37Z")

</div>

You should look into how the gradient is defined in the css, there is also a tooltip on the bottom right when you bind the property, stating the right format. Based on that, construct that string based on the format.

---

<div class="post-metadata">

**Author:** ![Wirajan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/wirajan/32/6438_2.png) [@Wirajan](https://community.weweb.io/u/Wirajan)\
**Post date:** [December 5, 2023, 3:23pm UTC](https://community.weweb.io/t/how-could-we-set-a-gradient-using-a-formula/5731/3 "2023-12-05T15:23:41Z")

</div>

oh, Nice!! Thankyou, @Broberto !!
