You need to sign in to do that
Don't have an account?

visualforce change text color conditionally
I am trying to change the text color on a visualforce page to one of four colors based on data contained in a field. The code is below. I have looked at similar posts but have not been successful. I would appreciate any help you could provide.
<apex:repeat value="{!wrappedSystems}" var="s">
<tr class="linkable">
<input type="hidden" class="id" data-type="system" data-id="{!s.sys.Id}" />
<td><c:RC_Donut theName="{!s.sys.Id}" percent="{!s.batRemaining}" /></td>
<td>{!s.sys.System_Name__c}</td>
<td><center><font color = "{if({!s.sys.Operational_Status_Color__c}='Red',#FF0000, if({!s.sys.Operational_Status_Color__c}='Yellow',#FFF000, if({!s.sys.Operational_Status_Color__c}='Green',#01DF01,#808080)))}">{!s.sys.Operational_Status__c}</font></center></td>
<td>{!s.sys.Status__c}</td>
<td>{!s.sys.System_City__c}, {!s.sys.System_State__c}</td>
</tr>
</apex:repeat>
<apex:repeat value="{!wrappedSystems}" var="s">
<tr class="linkable">
<input type="hidden" class="id" data-type="system" data-id="{!s.sys.Id}" />
<td><c:RC_Donut theName="{!s.sys.Id}" percent="{!s.batRemaining}" /></td>
<td>{!s.sys.System_Name__c}</td>
<td><center><font color = "{if({!s.sys.Operational_Status_Color__c}='Red',#FF0000, if({!s.sys.Operational_Status_Color__c}='Yellow',#FFF000, if({!s.sys.Operational_Status_Color__c}='Green',#01DF01,#808080)))}">{!s.sys.Operational_Status__c}</font></center></td>
<td>{!s.sys.Status__c}</td>
<td>{!s.sys.System_City__c}, {!s.sys.System_State__c}</td>
</tr>
</apex:repeat>
Can you try with style attribute logic as
<div style="color:{if({!s.sys.Operational_Status_Color__c}='Red',#FF0000, if({!s.sys.Operational_Status_Color__c}='Yellow',#FFF000, if({!s.sys.Operational_Status_Color__c}='Green',#01DF01,#808080)))}"> Text to Display</div>
Please mark this as best answer, if this helps to you.
I have test this code. it's working 100% .Please use
Please MARK AS BEST ANSWER!!!
Regards
Mukesh