I'm currently re-writing my layout / UI, but on my old layout, I did this:
https://github.com/greven/oUF_Lumen/...tions.lua#L659
Lua Code:
-- Colorize the last power color element
local function SetMaxClassPowerColor(element, max, powerType)
if not element or not max then return end
local color = element.__owner.colors.power.max[powerType]
if element[max] and color then
local r, g, b = color[1], color[2], color[3]
local LastBar = element[max]
LastBar:SetStatusBarColor(r, g, b)
local bg = LastBar.bg
if (bg) then
local mu = bg.multiplier or 1
bg:SetColorTexture(r * mu, g * mu, b * mu)
end
end
end
-- Post Update ClassPower
local function PostUpdateClassPower(element, cur, max, diff, powerType)
local frame = element.__owner.mystyle
if (diff) then
local maxWidth, gap = cfg.units[frame].width, 6
for i = 1, max do
local Bar = element[i]
Bar:SetWidth(((maxWidth / max) - (((max - 1) * gap) / max)))
if (i > 1) then
Bar:ClearAllPoints()
Bar:SetPoint("LEFT", element[i - 1], "RIGHT", gap, 0)
end
end
end
SetMaxClassPowerColor(element, max, powerType)
end