You've only got one variable for color in your controller, so you can't expect to get more than one color in your VisualForce page. You'll want to create a class that stores both a carrier__c
object and a color, and then create a list to store an instance of your object for each carrier__c
.
public class colorAndObject {
public string color{get; set;}
public carrier__c carrier{get;set;}
public colorAndObject(string carColor, carrier__c carrierName) {
color = carColor;
carrier = carrierName;
}
}
list<colorAndObject> carriersWithColors = new list<colorAndObject>();
In your VisualForce page, instead of using {!carriers}
for your table value, use your carriersWithColors
list.
<apex:pageblocktable value="{!carriersWithColors }" var="c">
<apex:column headervalue="Carrier">
<font color="{!c.color}">
<apex:outputtext value="{!c.carrier.name}" />
</font>
</apex:column>
That should be enough to get you started. I'll let you fill in the gaps.