WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Classic - AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=180)
-   -   Change font colour of the HP-text from Blizzard-Raid Frames (https://www.wowinterface.com/forums/showthread.php?t=57758)

rulezyx 01-02-20 09:33 PM

Change font colour of the HP-text from Blizzard-Raid Frames
 
For WoW Classic,

Is it possible to change the 'greyish' color of the 'lost health' text from the default raid frames to something more visible like red? I changed the font but I wonder if and how you can change the color too.

Seerah 01-03-20 01:50 PM

How did you change the font?

rulezyx 01-04-20 09:10 PM

https://pastebin.com/ZGPvVgzW

I ripped that from an older file. Its working but not perfectly. I hope someone can rewirte/correct it. Some side Informations are above the hook in the link.

Since the default font is faded out and grey the color change could help healers alot. Also it makes the classic raidframes and the losthealth-text function more interesting to use.

Vrul 01-05-20 11:17 AM

Not tested but you can try:
Code:

hooksecurefunc("CompactUnitFrame_UpdateStatusText", function(self)
        local statusText = self.statusText
        if statusText and statusText:IsShown() then
                if self.optionTable.healthText == "losthealth" and tonumber(statusText:GetText() or "") then
                        if not statusText.fontOverridden then
                                statusText.fontOverridden = true
                                statusText:SetFont("Fonts\\ARIALN.TTF", 16)
                                statusText:SetTextColor(0.95, 0.2, 0.2)
                        end
                elseif statusText.fontOverridden then
                        statusText.fontOverridden = nil
                        statusText:SetFont("Fonts\\FRIZQT__.TTF", 12)
                        statusText:SetTextColor(0.5, 0.5, 0.5)
                end
        end
end)


rulezyx 01-05-20 11:37 AM

Thank you! I will test it and tell you :)

rulezyx 01-05-20 12:03 PM

It works but sometimes the losthealth-text appeares to be smaller (fontsize) on certain players, maybe because out of range. Is there a way to change that?

- Ok I changed the font size from 12 to 16 now its working fine.

Is it possible to create an outline / shadow for the font so it gets more visible?

Vrul 01-05-20 12:43 PM

For an outline change:
Code:

statusText:SetFont("Fonts\\ARIALN.TTF", 16)
to
Code:

statusText:SetFont("Fonts\\ARIALN.TTF", 16, "OUTLINE")
For shadow just add these lines after the SetFont and SetTextColor calls:
Code:

statusText:SetShadowColor(0, 0, 0, 0.5)
statusText:SetShadowOffset(1, -1)

I'd only use an outline or shadow but not both so pick the one you think looks best.

rulezyx 01-05-20 01:07 PM

Thank you that helped alot! Yes the outline is way too much but with the shadow only theres literally no difference. Is it possible to dark the shadow a bit? I use flat textures for the raidframes thats why I need a difference to these colors.

Vrul 01-05-20 01:12 PM

The last number for SetShadowColor is the alpha (transparency) and can be a value for 0 (invisible) to 1 (solid):
Code:

statusText:SetShadowColor(0, 0, 0, 1)

Seerah 01-05-20 01:13 PM

Code:

statusText:SetShadowColor(0, 0, 0, 0.5) --red, green, blue, alpha

rulezyx 01-05-20 01:28 PM

That really helped me alot. Thank you both for the fast answers.:)

rulezyx 01-05-20 03:27 PM

2 Attachment(s)
Sorry for asking again but I tested it in battlegrounds and sometimes the health-text shows up in a different size. Is there a way to fix that? It should always be in the same size because everything else is pretty confusing.
Also the red color is a bit blurry. Is it possible to make it more mat/intense? :confused:
https://pastebin.com/x8zgAd6N
1. Picture ;Top right is pretty 'big' everything else is pretty small (guess should be default) and sometimes its the other way.
2. Picture ;Red looks a bit too orange/blurry.

rulezyx 01-05-20 04:01 PM

1 Attachment(s)
I tried to find out why the text-size is changing. For some reason its working sometimes. The text is rly big or rly small or mixed. Maybe I miss something.

jeruku 01-05-20 05:04 PM

The inner if statement stops it from defaulting back or instead of an elseif use an else.

Lua Code:
  1. if self.optionTable.healthText == "losthealth" and tonumber(statusText:GetText() or "") and not statusText.fontOverridden then
  2.       --blah
  3. end

rulezyx 01-05-20 05:19 PM

Ok I get that but if I change elseif to else its not working at all.

jeruku 01-05-20 05:29 PM

Sorry about that. Else is used when falling back and since it wouldn't be overridden setting the flag makes no difference so it should look something like this.

Lua Code:
  1. hooksecurefunc("CompactUnitFrame_UpdateStatusText", function(self)
  2.     local statusText = self.statusText
  3.     if statusText and statusText:IsShown() then
  4.         if self.optionTable.healthText == "losthealth" and tonumber(statusText:GetText() or "") and not statusText.fontOverridden then
  5.             statusText.fontOverridden = true
  6.             statusText:SetFont("Fonts\\ARIALN.TTF", 16)
  7.             statusText:SetTextColor(0.95, 0.2, 0.2)
  8.             statusText:SetShadowColor(0, 0, 0, 1)
  9.             statusText:SetShadowOffset(1, -1)
  10.         else
  11.             statusText.fontOverridden = nil
  12.             statusText:SetFont("Fonts\\ARIALN.TTF", 16)
  13.             statusText:SetTextColor(0.5, 0.5, 0.5)
  14.             statusText:SetShadowColor(0, 0, 0, 1)
  15.             statusText:SetShadowOffset(1, -1)
  16.         end
  17.     end
  18. end)

rulezyx 01-05-20 05:38 PM

I tried that but the text color is on default (grey) again. It somehow doesnt lock the red color. If I change around at the frame/text-hp settings it triggers the red color on some frames but not all, a few are still grey or getting grey again.

Vrul 01-05-20 07:12 PM

Give this a try:
Code:

hooksecurefunc("DefaultCompactUnitFrameSetup", function(self)
        local statusText = self.statusText
        statusText:SetFont("Fonts\\ARIALN.TTF", 16)
        statusText:SetShadowColor(0, 0, 0, 1)
        statusText:SetShadowOffset(1, -1)
end)

hooksecurefunc("CompactUnitFrame_UpdateStatusText", function(self)
        local statusText = self.statusText
        if statusText and statusText:IsShown() then
                if self.optionTable.healthText == "losthealth" and tonumber(statusText:GetText() or "") then
                        if not statusText.colorOverridden then
                                statusText.colorOverridden = true
                                statusText:SetTextColor(0.95, 0.1, 0.1, 1)
                        end
                elseif statusText.colorOverridden then
                        statusText.colorOverridden = nil
                        statusText:SetTextColor(0.5, 0.5, 0.5, 1)
                end
        end
end)


rulezyx 01-05-20 08:19 PM

2 Attachment(s)
Thanks alot Vrul. You did pretty much everything. :)Atm it works great. With smaller RaidFrames (like 40 ppl) the text is rly big (like in the first image). Is it possible to get this on default size (like in the second image).

Vrul 01-05-20 10:21 PM

Try changing the line:
Code:

statusText:SetFont("Fonts\\ARIALN.TTF", 16)
to:
Code:

statusText:SetFont("Fonts\\ARIALN.TTF", 16 * (statusText:GetHeight() or 12) / 12)


All times are GMT -6. The time now is 07:09 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2019 MMOUI