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

Change text colour of embedded data variable

  • March 12, 2020
  • 2 replies
  • 108 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> ```

2 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • March 13, 2020
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
  • March 16, 2020
Thanks @TomG - very simple and working perfectly.