Quantcast Change font colour of the HP-text from Blizzard-Raid Frames - WoWInterface
Thread Tools Display Modes
01-02-20, 09:33 PM   #1
rulezyx
A Fallenroot Satyr
Join Date: Jan 2020
Posts: 29
Post 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.
  Reply With Quote
01-03-20, 01:50 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,719
How did you change the font?
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-04-20, 09:10 PM   #3
rulezyx
A Fallenroot Satyr
Join Date: Jan 2020
Posts: 29
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.
  Reply With Quote
01-05-20, 11:17 AM   #4
Vrul
An Onyxian Warder
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 352
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)
  Reply With Quote
01-05-20, 11:37 AM   #5
rulezyx
A Fallenroot Satyr
Join Date: Jan 2020
Posts: 29
Thank you! I will test it and tell you
  Reply With Quote
01-05-20, 12:03 PM   #6
rulezyx
A Fallenroot Satyr
Join Date: Jan 2020
Posts: 29
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?

Last edited by rulezyx : 01-05-20 at 12:27 PM.
  Reply With Quote
01-05-20, 12:43 PM   #7
Vrul
An Onyxian Warder
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 352
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.
  Reply With Quote
01-05-20, 01:07 PM   #8
rulezyx
A Fallenroot Satyr
Join Date: Jan 2020
Posts: 29
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.
  Reply With Quote
01-05-20, 01:12 PM   #9
Vrul
An Onyxian Warder
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 352
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)
  Reply With Quote
01-05-20, 01:13 PM   #10
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,719
Code:
statusText:SetShadowColor(0, 0, 0, 0.5) --red, green, blue, alpha
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
01-05-20, 01:28 PM   #11
rulezyx
A Fallenroot Satyr
Join Date: Jan 2020
Posts: 29
That really helped me alot. Thank you both for the fast answers.
  Reply With Quote
01-05-20, 03:27 PM   #12
rulezyx
A Fallenroot Satyr
Join Date: Jan 2020
Posts: 29
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?
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.
Attached Thumbnails
Click image for larger version

Name:	312312.PNG
Views:	193
Size:	139.9 KB
ID:	9392  Click image for larger version

Name:	312321.PNG
Views:	27
Size:	9.1 KB
ID:	9393  

Last edited by rulezyx : 01-05-20 at 04:14 PM.
  Reply With Quote
01-05-20, 04:01 PM   #13
rulezyx
A Fallenroot Satyr
Join Date: Jan 2020
Posts: 29
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.
Attached Thumbnails
Click image for larger version

Name:	6412421.PNG
Views:	31
Size:	40.6 KB
ID:	9394  

Last edited by rulezyx : 01-05-20 at 04:39 PM.
  Reply With Quote
01-05-20, 05:04 PM   #14
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 214
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
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison

Last edited by jeruku : 01-05-20 at 05:04 PM. Reason: Continuity.
  Reply With Quote
01-05-20, 05:19 PM   #15
rulezyx
A Fallenroot Satyr
Join Date: Jan 2020
Posts: 29
Ok I get that but if I change elseif to else its not working at all.
  Reply With Quote
01-05-20, 05:29 PM   #16
jeruku
A Cobalt Mageweaver
 
jeruku's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 214
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)
__________________
"I have not failed, I simply found 10,000 ways that did not work." - Thomas Edison
  Reply With Quote
01-05-20, 05:38 PM   #17
rulezyx
A Fallenroot Satyr
Join Date: Jan 2020
Posts: 29
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.
  Reply With Quote
01-05-20, 07:12 PM   #18
Vrul
An Onyxian Warder
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 352
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)
  Reply With Quote
01-05-20, 08:19 PM   #19
rulezyx
A Fallenroot Satyr
Join Date: Jan 2020
Posts: 29
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).
Attached Thumbnails
Click image for larger version

Name:	6412421.PNG
Views:	28
Size:	40.6 KB
ID:	9396  Click image for larger version

Name:	712387r.PNG
Views:	28
Size:	36.7 KB
ID:	9397  
  Reply With Quote
01-05-20, 10:21 PM   #20
Vrul
An Onyxian Warder
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 352
Try changing the line:
Code:
statusText:SetFont("Fonts\\ARIALN.TTF", 16)
to:
Code:
statusText:SetFont("Fonts\\ARIALN.TTF", 16 * (statusText:GetHeight() or 12) / 12)
  Reply With Quote

WoWInterface » Classic - AddOns, Compliations, Macros » Classic - AddOn Search/Requests » Change font colour of the HP-text from Blizzard-Raid Frames

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