Hello.
Blizzard refactored the GossipFrame… but i don’t understand their new code and I cant change the textcolor of a specific element. Im using the addon-skins api to skin frames, everything works fine. But here is the problem:
I stripped everything from the gossip frame and changed the “GreetingText” font to white. But I cant change the “quest option” - its still a black text with a yellow “!”.
TLDR: How can I change the font/text-color of gossip options?
Here is the framestack of the element:
(wotlk classic interface, which “should” be the same as the mainline interface now.)
The game uses color codes in the text rather than setting the color of the FontString object, so I used the same approach.
ScrollUtil.AddInitializedFrameCallback(GossipFrame.GreetingPanel.ScrollBox, function(_, frame, elementData)
local buttonType = elementData.buttonType
if buttonType == GOSSIP_BUTTON_TYPE_TITLE then
frame.GreetingText:SetText(RED_FONT_COLOR:WrapTextInColorCode(elementData.text))
elseif buttonType == GOSSIP_BUTTON_TYPE_OPTION then
frame:SetText(GREEN_FONT_COLOR:WrapTextInColorCode(elementData.info.name))
-- there's also elementData.info.isIgnored and elementData.info.isTrivial for the next two types, which the game uses to apply different styles
-- https://sourcegraph.com/github.com/Gethe/wow-ui-source@3.4.1/-/blob/Interface/FrameXML/GossipFrameShared.lua?L22
elseif buttonType == GOSSIP_BUTTON_TYPE_ACTIVE_QUEST then
frame:SetText(BLUE_FONT_COLOR:WrapTextInColorCode(elementData.info.title))
elseif buttonType == GOSSIP_BUTTON_TYPE_AVAILABLE_QUEST then
frame:SetText(YELLOW_FONT_COLOR:WrapTextInColorCode(elementData.info.title))
end
end)
thanks a lot for you time you really helped me a lot.
btw:
the blue and green looks great. will keep it …but the red has to go! =P
thank you~ ^-^
edit:
how do you know about ScrollUtil and AddInitializedFrameCallback? and the color codes? are there any docs about this somewhere?
edit2:
found it… scrollutil.lua (xd)
-- Assigns a callback to be invoked every time a frame is initialized. Initialization occurs after
-- every frame has been anchored and a layout pass performed, which is necessary if the frame's initializer
-- needs to ask for information about it's size to inform layout decisions within itself.
-- For convenience, you can leverage the 'iterateExisting' argument to immediately invoke the callback on any existing frames.
function ScrollUtil.AddInitializedFrameCallback(scrollBox, callback, owner, iterateExisting)
if iterateExisting then
scrollBox:ForEachFrame(callback);
end
local function OnInitialized(o, frame, elementData)
callback(o, frame, elementData);
end
scrollBox:RegisterCallback(ScrollBoxListMixin.Event.OnInitializedFrame, OnInitialized, owner);
end
No docs, just searching through Blizzard UI code basically. They generate the global color constants from C_UIColor.GetColors() these days. You can use CreateColor(r, g, b, a) to define your own Colors.