Ahhh, yeah I see what you want to do now.
In the default power bar update colouring by power type has a higher priority than colouring by unit class. So, if you turn on colouring by power type it will occur for all units.
It is possible to use your own power update routine within your layout without modifying oUF directly.
Add a routine like below (default power update routine with order of power and class colouring swapped):
Code:
local MyPowerUpdate = function(self, event, unit)
if(self.unit ~= unit) then return end
local power = self.Power
if(power.PreUpdate) then power:PreUpdate(unit) end
local min, max = UnitPower(unit), UnitPowerMax(unit)
local disconnected = not UnitIsConnected(unit)
power:SetMinMaxValues(0, max)
if(disconnected) then
power:SetValue(max)
else
power:SetValue(min)
end
power.disconnected = disconnected
power.unit = unit
local r, g, b, t
if(power.colorTapping and UnitIsTapped(unit) and not UnitIsTappedByPlayer(unit)) then
t = self.colors.tapped
elseif(power.colorDisconnected and not UnitIsConnected(unit)) then
t = self.colors.disconnected
elseif(power.colorHappiness and UnitIsUnit(unit, "pet") and GetPetHappiness()) then
t = self.colors.happiness[GetPetHappiness()]
elseif(power.colorClass and UnitIsPlayer(unit)) or
(power.colorClassNPC and not UnitIsPlayer(unit)) or
(power.colorClassPet and UnitPlayerControlled(unit) and not UnitIsPlayer(unit)) then
local _, class = UnitClass(unit)
t = self.colors.class[class]
elseif(power.colorPower) then
local ptype, ptoken, altR, altG, altB = UnitPowerType(unit)
t = self.colors.power[ptoken]
if(not t and altR) then
r, g, b = altR, altG, altB
end
elseif(power.colorReaction and UnitReaction(unit, 'player')) then
t = self.colors.reaction[UnitReaction(unit, "player")]
elseif(power.colorSmooth) then
r, g, b = self.ColorGradient(min / max, unpack(power.smoothGradient or self.colors.smooth))
end
if(t) then
r, g, b = t[1], t[2], t[3]
end
if(b) then
power:SetStatusBarColor(r, g, b)
local bg = power.bg
if(bg) then
local mu = bg.multiplier or 1
bg:SetVertexColor(r * mu, g * mu, b * mu)
end
end
if(power.PostUpdate) then
return power:PostUpdate(unit, min, max)
end
end
and in your style function add in:
Code:
self.Power.colorClass = true
self.Power.colorPower = true
self.Power.Update = MyPowerUpdate
This will cause player characters to have the power coloured by class and for all other units it will be coloured by power type.
Hope that helps