Change font color by formula

I have been reading about changing the color of a cell, and it reminded me that I would like to change the color of the font to red with negative numbers, while leaving it black for positive numbers, in a Text Display Object. This does not work as a formula in rich text, even evaluating the formula twice, but I think that it could work by changing the literal text. Has anyone done this?

I made an Amount field set to floating point with various values both positive and negative. I then created a Text Display Object set to formula and rich text enabled with this formula:


As shown below the text changed color depending upon the value of the Amount field.

TDO Color

That is not working for what I am doing. The value is computed: pattern(Value - «Previous Close»,"#,.##"). I have tried a number of permutations, and always get an operand where operator expected error message.

Here is what seems to work for me for your situation:

?((Value - «Previous Close»)>-0,"<color:000000>"+pattern(Value - «Previous Close»,"#,.##"),"<color:FF0000>"+pattern(Value - «Previous Close»,"#,.##"))

It also worked with this.

?(Value-«Previous Close» < 0.0,
"<color:FF0000>"+pattern(Value-«Previous Close»,"#,.##"),
pattern(Value-«Previous Close»,"#,.##"))

Okay, I see what the problem was. The tag needs to be inserted as a string, and I was not doing that. Thank you!