Pricing Blog

Changing background color dynamically

  • gumoandreatta-1226960266672078848

    GumoAndreatta

    1 year ago

    I was wondering if it's possible to change the color of a background dynamically with variables
  • andreasmoller-1226965171688443904

    Andreas Møller

    1 year ago

    Yes you Can use style variables
    👍1
  • andreasmoller-1226965445953847347

    Andreas Møller

    1 year ago

    Create a style variable at the top of the style panel, the use it fir Setting the bg
  • gumoandreatta-1226970846548197398

    GumoAndreatta

    1 year ago

    but if possible to change it with a formula or something ? I'm trying to change the background-color depending the location of the user but I'm not sure how to do it
  • yoelfdz-1227048170773544970

    yoelfdz

    1 year ago

    Get the location of the customer through API, create a style variable on the div you want to but the backgroung on and set up if conditions. Example, if location equals UK background #777b83, else if locations equals ES... and repeat that
    👍1
  • yoelfdz-1227048470930657311

    yoelfdz

    1 year ago

    You can create a custom formula to simplify that or you could store the location and color combinations in a object variable and use that