Quantcast Change HighlightFont - WoWInterface
Thread Tools Display Modes
10-13-19, 11:22 AM   #1
Zam89
A Deviate Faerie Dragon
Join Date: Mar 2019
Posts: 18
Change HighlightFont

Hi,

how can I Change the "HighlightFont" which is set in the XML in lua?

In XML: <HighlightFont style="GameFontHighlight"/>

Need to Change the HighliteFont for a Default Blizzard button into black

Thanks.
  Reply With Quote
10-13-19, 12:15 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,845
Code:
local highlight=Button:GetHighlightFontObject();
highlight:SetTextColor(0,0,0);
Note: If you're not doing anything else with the FontString, you can do this instead.
Code:
Button:GetHighlightFontObject():SetTextColor(0,0,0);
__________________
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
10-13-19, 12:51 PM   #3
Zam89
A Deviate Faerie Dragon
Join Date: Mar 2019
Posts: 18
Thanks.

But the text is changing into White:

THis is the Blizzard Code:

Code:
<Button name="StaticPopupButtonTemplate" virtual="true">
		<Size x="128" y="21"/>
		<Animations>
			<AnimationGroup parentKey="PulseAnim" looping="BOUNCE">
				<Alpha childKey="Flash" fromAlpha="0" toAlpha="1" duration="0.5" order="1"/>
				<Alpha childKey="Flash" fromAlpha="1" toAlpha="0" duration="0.5" order="2"/>
			</AnimationGroup>
		</Animations>
		<Layers>
			<Layer level="OVERLAY" textureSubLevel="1">
				<Texture parentKey="Flash" file="Interface\Buttons\UI-Panel-Button-Glow" alphaMode="ADD" alpha="0">
					<Size x="140" y="40"/>
					<Anchors>
						<Anchor point="CENTER"/>
					</Anchors>
					<TexCoords left="0.0" right="0.75" top="0.0" bottom="0.609375"/>
				</Texture>
			</Layer>
		</Layers>
		<Scripts>
			<OnClick>
				StaticPopup_OnClick(self:GetParent(), self:GetID());
			</OnClick>
		</Scripts>
		<ButtonText name="$parentText">
			<Anchors>
				<Anchor point="CENTER">
					<Offset x="0" y="1"/>
				</Anchor>
			</Anchors>
		</ButtonText>
		<NormalTexture file="Interface\Buttons\UI-DialogBox-Button-Up">
			<TexCoords left="0.0" right="1.0" top="0.0" bottom="0.71875"/>
		</NormalTexture>
		<PushedTexture file="Interface\Buttons\UI-DialogBox-Button-Down">
			<TexCoords left="0.0" right="1.0" top="0.0" bottom="0.71875"/>
		</PushedTexture>
		<DisabledTexture file="Interface\Buttons\UI-DialogBox-Button-Disabled">
			<TexCoords left="0.0" right="1.0" top="0.0" bottom="0.71875"/>
		</DisabledTexture>
		<HighlightTexture file="Interface\Buttons\UI-DialogBox-Button-Highlight" alphaMode="ADD">
			<TexCoords left="0.0" right="1.0" top="0.0" bottom="0.71875"/>
		</HighlightTexture>
		<NormalFont style="GameFontNormal"/>
		<DisabledFont style="GameFontDisable"/>
		<HighlightFont style="GameFontHighlight"/>
	</Button>

And this is what I have done with the button:

Code:
_G["StaticPopup" .. i .. "Button" .. ii]:SetNormalTexture("Interface\\AddOns\\GW2_UI\\textures\\button")
                _G["StaticPopup" .. i .. "Button" .. ii]:SetHighlightTexture("Interface\\AddOns\\GW2_UI\\textures\\button")
                _G["StaticPopup" .. i .. "Button" .. ii]:SetPushedTexture("Interface\\AddOns\\GW2_UI\\textures\\button")
                _G["StaticPopup" .. i .. "Button" .. ii .. "Text"]:SetTextColor(0, 0, 0, 1)
                _G["StaticPopup" .. i .. "Button" .. ii]:GetHighlightFontObject():SetTextColor(0,0,0)
                _G["StaticPopup" .. i .. "Button" .. ii .. "Text"]:SetShadowOffset(0, 0)
                _G["StaticPopup" .. i .. "Button" .. ii .. "Text"]:SetDrawLayer("OVERLAY")
But when I hove the Button the button Color Changed to White:

Image

But it should stay black

Last edited by Zam89 : 10-13-19 at 12:53 PM.
  Reply With Quote
10-13-19, 10:22 PM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,345
Ignore the following if you did mean the font itself and not the image.


It looks like someone years back had a similar problem and posted the query on another site and got an answer ..

https://www.mmo-champion.com/threads...-on-mouse-over

This is the actual line of code to change the color of the image .. set these to 0,0,0 for black
button3:GetNormalTexture():SetVertexColor(r, g, b);

What you changed in your code to 0,0,0 is the font text and not the image itself. So you may want to revert that back to what it was so that you can see the writing properly.

Give that a go and let us know how you eventually got it working ( if you did that is )
__________________
  Reply With Quote
10-14-19, 01:19 AM   #5
Zam89
A Deviate Faerie Dragon
Join Date: Mar 2019
Posts: 18
Thanks, that was the perfect hint
Added the vertex color and add a Owen onenter and in leave script.

Works perfect
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Change HighlightFont

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off