View Single Post
03-13-14, 04:35 PM   #22
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by Phanx View Post
Add the part highlighted in teal:
Code:
			else
				if value < valueMax then
					for j = 1, #shorts do
						local v = shorts[j]
						if valueMax >= v[1] then
							return fontString:SetFormattedText(t[3] .. "/" .. v[3], value / t[2], valueMax / v[2])
						end
					end
				end
				return fontString:SetFormattedText(t[3], value / t[2])
			end
Thank You for this code it works perfectly.

Last question then I think I'm done with font's.

My tooltip addon I use is based primarily off of nTooltip and for his pets he uses a color like:

Code:
r = 157/255
g = 197/255
b = 255/255

How would I get the highlighted yellow code to be this color:

Code:
hooksecurefunc("UnitFrame_Update", function(self)
    if not self.name then return end

    local unit, color = self.unit
    if UnitPlayerControlled(unit) then
        if UnitIsPlayer(unit) then
            local _, class = UnitClass(unit)
            color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)[class]
        else
            color = HIGHLIGHT_FONT_COLOR
        end
    elseif UnitIsDead(unit) or UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit) then
        color = GRAY_FONT_COLOR
    else
        color = FACTION_BAR_COLORS[UnitIsEnemy(unit, "player") and 1 or UnitReaction(unit, "player") or 5]
    end
 
    if not color then
        color = (CUSTOM_CLASS_COLORS or RAID_CLASS_COLORS)["PRIEST"]
    end
 
    self.name:SetTextColor(color.r, color.g, color.b)
end)
I know its a minor thing but I would like when I tooltip over a unit for the color in the tooltip to match the color of the font on the unit.

I know I couldjust change the tooltip font to:

Code:
r = 1
g = 1
b = 1
and this would give me a white on the tooltip. But I kinda like the other color.

Thanks again for all your guys help with my font questions.

Coke
  Reply With Quote