Font:SetAlpha
Jump to navigation
Jump to search
Sets the alpha of the text.
Font:SetAlpha(alpha)
Arguments
- alpha
- number
[0.0-1.0]
- 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
Patch 1.10.0 (2006-03-28): Added.[1]
References
- ^ Iriel 2005-12-28. Upcoming 1.10 Changes - Concise List. Archived from the original