Wowpedia
Advertisement
Wowpedia
240,442
pages

Manages the alpha (or opacity) of any text using a Font object.

font:SetAlpha(alpha)
alpha = font:GetAlpha()

Attribute

alpha 
number - Opacity of the text as a proportion from 0 (transparent) to 1 (opaque)

Details

  • Font:SetAlpha() and Region:SetAlpha() are two different kinds of alpha, but how they interact varies:
    • FontString simply adopts whichever alpha was set most recently.
    • EditBox, SimpleHTML and MessageFrame use their Region alpha for backgrounds and borders, but multiply both alphas together for text.

Example

An EditBox with 50% alpha, assigned a Font with 50% alpha. The text's net alpha is returned using a generic formula.

local frame = CreateFrame("EditBox")
frame:SetAlpha(0.5)
frame:SetFontObject(CreateFont("MyFont"));
frame:GetFontObject():SetAlpha(0.5)
local netAlpha = ( (frame:IsIgnoringParentAlpha() and frame:GetAlpha()) or frame:GetEffectiveAlpha() ) * ( (frame:GetFontObject() and frame:GetFontObject():GetAlpha()) or 1 )
print(netAlpha)   --0.25

Patch changes

References

Advertisement