View Single Post
08-08-16, 05:04 PM   #5
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
You will most likely have to use secure hooks. For an example, here is the function I use in !ClassColors to apply custom class colors to the health bars of the default raid frames:

lua Code:
  1. hooksecurefunc("CompactUnitFrame_UpdateHealthColor", function(frame)
  2.     if frame.optionTable.useClassColors and UnitIsConnected(frame.unit) then
  3.         local _, class = UnitClass(frame.unit)
  4.         if class then
  5.             local color = CUSTOM_CLASS_COLORS[class]
  6.             if color then
  7.                 frame.healthBar:SetStatusBarColor(color.r, color.g, color.b)
  8.             end
  9.         end
  10.     end
  11. end)

You'll need to change the function, object, and table names, but otherwise it should be pretty similar. You can't modify the original table at all, so you'll need to add a bunch more hooks to apply your custom colors to power bars in other parts of the UI as well.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote