Change text colour of embedded data variable | Experience Community
Skip to main content
Solved

Change text colour of embedded data variable

  • Mar 12, 2020 11:04 PM UTC
  • 2 replies
  • 134 views

Forum|alt.badge.img+1
I have embedded data variables that assign a category based on a score (eg. if score is under 5, category is 'high'). I want to present the category back to the respondent, and colour the text based on the category (ie. red for high). Because of the vast number of combinations (each respondent has 12 scores with 3+ categories) display logic seems tricky. Does anyone have a way to approach this using javascript, css, html? I am new to all of them and would appreciate a push in the right direction.

Best answer by TomG

When you assign the category ED also assign a categoryColor ED. Then your html is: ``` <span style="color:${e://Field/categoryColor}">${e://Field/category}</span> ```
View original

2 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • Mar 13, 2020 2:01 PM UTC
When you assign the category ED also assign a categoryColor ED. Then your html is: ``` <span style="color:${e://Field/categoryColor}">${e://Field/category}</span> ```

Forum|alt.badge.img+1
  • Author
  • Mar 16, 2020 3:56 AM UTC
Thanks @TomG - very simple and working perfectly.