View Single Post
03-11-16, 12:30 PM   #32
ceylina
A Wyrmkin Dreamwalker
Join Date: Oct 2014
Posts: 50
Not sure if you want it at all but here is my coding for health and power bars

I only color the health or power percentage and not the current/max health amount.

Health:

Code:
local cur, max = HP(unit), MaxHP(unit)
local r,g,b = HPColor(cur,max)
return "%s/%s |cff%02x%02x%02x(%s%%)|r",Short(cur,true),Short(max,true),r,g,b,Percent(cur,max)

Power:

Code:
local cur,max = Power(unit),MaxPower(unit)
local _,power_name = UnitPowerType(unit)
local r,g,b = PowerColor(power_name)
  return "%s/%s |cff%02x%02x%02x(%s%%)|r",Short(cur,true),Short(max,true),r,g,b,Percent(cur,max)

Druid mana

Code:
if UnitPowerType(unit) ~= 0 and DruidForm(unit) then
  local max = MaxPower(unit,0)
  local color = PitBull4.PowerColors["MANA"]
  local r,g,b = color[1]*255, color[2]*255, color[3]*255
    return "|cff%02x%02x%02x(%s%%)|r",r,g,b,Percent(Power(unit,0),max)
end
  Reply With Quote