View Single Post
08/01/14, 02:47 AM   #1
w33zl
 
w33zl's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 13
Opacity/alpha channel on text, how?

When you define a color using RGB you could attach an alpha channel to add transparency. My question is how to achieve this on text when using the "|c" formatting option?

If I would set the color of an entire label to red I could do like this:
Code:
myLabel:SetColor(255, 0, 0) -- equivivalent of hex code FF0000
Or I could do like this:
Code:
myLabel:SetText("|cFF0000" .. myText .. "|r")
If I would like the red text to be semi-transparent I could do like this according to the method in the first example:
Code:
myLabel:SetColor(255, 0, 0, 0.5) -- equivivalent of hex code FF0000 with 50% transparency
But how do I achieve this using the "|c" method? I would like to do anything similar to:
Code:
myLabel:SetText("|cFF00007F" .. myText .. "|r")
Or:
Code:
myLabel:SetText("|cFF0000|7F" .. myText .. "|r")
But neither alternatives works. Could anyone shine some light on this issue?

BR,
w33zl
  Reply With Quote