Change title color according to a condition

I have a title in a Repeat whose value comes from a data variable. I want to change the color of this title depending on a condition. How can I do this? Another question: how can I store the value of this title in a variable?
Thanks.