For what it's worth, and since I am asking for help myself I thought I could share some other LUA scripts that I use for anyone looking to add some tweaks to their UI.
To configure this in Pitull you go to the Layout Editor and pick the layout you want to modify and then go to the Text tab. Use the combo box to select the text you want to modify for that layout.
I put an outline on all mine since I think it improves legibility, that's just "Outline()" before whatever code follows.
Quote:
Outline()
local r,g,b = ClassColor(unit)
return '|cff%02x%02x%02x%s%%',r,g,b,Percent(HP(unit),MaxH P(unit))
This one displays health as a percentage in the unit's class color.
Quote:
Outline()
local s = Status(unit)
if s then
return s
end
local cur, max = HP(unit), MaxHP(unit)
local r,g,b=ClassColor(unit)
return '|cff%02x%02x%02x%s/%s || %s%%|r',r,g,b,Short(cur,true),Short(max,true),Perc ent(cur,max)
This one also puts health into class color but has the format of "25.5K/25.5k | 100%" instead of just percent.
Quote:
Outline()
local abbr = Name(unit)
local r,g,b = DifficultyColor(unit)
if abbr:len() > 30 and abbr:find(" ")
then abbr = abbr:gsub("([^ ]+) +", function(text)
return text:sub(1,1) .. ". " end)
end
if UnitIsPlayer(unit) then
local r,g,b = ClassColor(unit)
return "|cff%02x%02x%02x%s|r",r,g,b,abbr
else
return "|cff%02x%02x%02x%s|r",r,g,b,abbr
end
This one will abbreviate the name if it is over 30 characters long (change the "30" to another value if you need to lengthen/shorten) and colors the unit name based on whether it's a player (in which case it is class colored) or if it's an NPC (in which it's colored by its difficulty level relative to you). Helpful for target frames since it won't try to assign a class to the the boss.
Quote:
Outline()
return "|cffABD473%s|r",Name(unit)
This one sets the name text to whatever color you specify in hex terms. The color part is the ABD473, which is the hunter class color.
Quote:
Outline()
local r,g,b = ClassColor(unit)
return '|cff%02x%02x%02x%s%%',r,g,b,VeryShort(HP(unit))
This one is similar to an earlier code, but shows class colored health text in mini format (such as 41k). This is helpful on raid frames to quickly determine who the tank is.