WoW:API FontInstance SetTextColor: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
m (Move page script moved page API FontInstance SetTextColor to API FontInstance SetTextColor without leaving a redirect)
 
(5 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<center>'''SetTextColor''' ''-Documentation by DerGhulbus-''</center>
{{widgetmethod}}


Button:SetText(r, g, b)
Sets the object's text color.


Sets the Button's text color.
obj:SetTextColor(red, green, blue[, alpha])


----
== Arguments ==
;''Arguments''


:Float
:;red: Number - Red part of color (0.0 -- 1.0)
:;r: Red part of new color (1.0 for 100% intensity)
:;green: Number - Green part of color (0.0 -- 1.0)
:Float
:;blue: Number - Blue part of color (0.0 -- 1.0)
:;g: Green part of new color (1.0 for 100% intensity)
:;alpha: Number - Alpha (transparency) value (0.0 for totally transparent, 1.0 for solid color)
:Float
:;b: Blue part of new color (1.0 for 100% intensity)


----
;12/5/08
;''Returns''
::Note that Button:SetTextColor was deleted in 3.0, but FontInstance:SetTextColor remains. To set the button text color, you need to set the button font object, then get a copy of it, then modify the color of the new object and then assign the copy back to the button. For example:


???
button:SetNormalFontObject("GameFontHighlight");
local font = button:GetNormalFontObject();
font:SetTextColor(1, 0.5, 0.25, 1.0);
button:SetNormalFontObject(font);


----
== See Also ==
;''See also:''
* [[API Button SetHighlightTextColor|Button:SetHighlightTextColor]]()
 
[[API_Button_SetHighlightTextColor]]
 
----
{{WoW API}}

Latest revision as of 04:45, 15 August 2023

Widget API ← FontInstance < SetTextColor

Sets the object's text color.

obj:SetTextColor(red, green, blue[, alpha])

Arguments[edit]

red
Number - Red part of color (0.0 -- 1.0)
green
Number - Green part of color (0.0 -- 1.0)
blue
Number - Blue part of color (0.0 -- 1.0)
alpha
Number - Alpha (transparency) value (0.0 for totally transparent, 1.0 for solid color)
12/5/08
Note that Button:SetTextColor was deleted in 3.0, but FontInstance:SetTextColor remains. To set the button text color, you need to set the button font object, then get a copy of it, then modify the color of the new object and then assign the copy back to the button. For example:
button:SetNormalFontObject("GameFontHighlight");
local font = button:GetNormalFontObject();
font:SetTextColor(1, 0.5, 0.25, 1.0);
button:SetNormalFontObject(font);

See Also[edit]