View Single Post
04/25/14, 08:00 AM   #1
meaghs
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 5
Set colour of font

Hiya all

In my addon I am pushing a string to my label like so:
STAddonLabelHTD:SetText(string.format("%s for %d", someString, someNumber))

and then label ends up something like this:

<Controls>
<Label name="$(parent)LabelHTD" font="ZoFontGameMedium" wrapMode="ELLIPSIS" verticalAlignment="CENTER" text="HTD">
<Anchor point="LEFT" offsetX="5" offsetY="-20" />
</Label>
</Controls>

I would like to change the colour of my label or text based on the someNumber. For example, if someNumber is lt 20 then the text would display green, if it is more than twenty it would be red. What is the most efficient (and easiest as i'm a lazy programmer) way to go about this?

thanks! - M.
  Reply With Quote