If Condition Text Color Changes

Hi Text Blaze Community,

Is it possible to use "if conditions" to change the color of a variable? For example:

Total Cholesterol (TC): {formtext: name=TC} mg/dL
If TC <200 = Green text, If TC 200-240 = Yellow text, If >240 = Red text

I need the number and units to turn color based on the variable value.

Thanks in advance for your help!

Hi @Abby_Buccino welcome to the forum! :slight_smile:

You would need to create separate parts for each condition and then apply color to each part separately.

{formtext: name=value}
{if: value > 240}
red text
{endif}
{if: value >= 200 and value <= 240}
yellow text
{endif}
{if: value < 200}
green text
{endif}

(forum doesn't support colored text which is why the above texts will all appear uncolored)

Further if you have a variable that needs to be colored, you can do that too.

{formtext: name=value}
{if: value > 240}
{=value}
{endif}
{if: value >= 200 and value <= 240}
{=value}
{endif}
{if: value < 200}
{=value}
{endif}

In the above snippet, you can select the =value chip using your mouse and then apply color to it.

Let me know if that helps.

1 Like

I just wanted to send a very delayed thank you! This has helped me and my team tremendously!

2 Likes