Skip to content

Commit bfb0251

Browse files
committed
Resource Bar: custom colours, textures, and Maelstrom/Pain
Three resource-bar additions: - Color Mode (Power Type / Class / Custom) with a custom-colour picker, replacing the old Use Class Color checkbox (migrated automatically). - A Texture dropdown so the fill can use any statusbar texture. - Maelstrom (Shaman) and Pain (Vengeance DH) added to the per-power colour list, so those resources can be recoloured instead of Blizzard's default. Colour resolution is centralised in DF:GetResourceBarColor; both render paths call it. The legacy resourceBarClassColor boolean migrates to resourceBarColorMode.
1 parent 7c322ab commit bfb0251

7 files changed

Lines changed: 90 additions & 32 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* (Fonts) Bundled **Roboto Mono** (SemiBold/Bold) — a monospaced option for perfectly static countdown text. (by Krathe)
1616
* (Icons) New **in-combat indicator** — a small crossed-swords icon lights up when a unit is in combat, so you can spot who's engaged at a glance. Off by default, with its own position and size controls. (by Krathe)
1717
* (Auto Layouts) Added `/df clearoverride <key|prefix|all>` to **remove a stuck per-layout override** directly — for overrides the settings UI can't reach (e.g. a pinned-players override while not in a raid). (by Krathe)
18+
* (Resource Bar) Added a **Color Mode** (Power Type / Class / **Custom**) with a custom-colour picker, and a **Texture** dropdown so the resource bar can use any statusbar texture. (by Krathe)
1819

1920
### Improvements
2021

@@ -28,6 +29,7 @@
2829
* (Test Mode) The separate **Status / Ready** and **Role / Leader** preview toggles are now a single **Icons** toggle, matching the live status-icon grouping. (by Krathe)
2930
* (Auto Layouts) The **override tooltip and `/df overrides` now read clearly** — each changed setting shows as a breadcrumb path with its value, only values that differ from global are listed, Text Designer elements show their names, and the override counts agree across the badge, status line and chat. (by Krathe)
3031
* (Aura Designer) Expiring health-bar highlights now **pulse in unison** across all frames — and tint and replace modes share one pulse engine — instead of each frame pulsing on its own timing. (by Krathe)
32+
* (Resource Bar) Added **Maelstrom** and **Pain** to the per-power resource colour options, so Shaman and Vengeance Demon Hunter resource bars can be recoloured. (by Krathe)
3133

3234
### Bug Fixes
3335

Config.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,6 +1905,8 @@ DF.PartyDefaults = {
19051905
WARRIOR = true,
19061906
},
19071907
resourceBarClassColor = false,
1908+
resourceBarColorMode = "POWER_TYPE",
1909+
resourceBarCustomColor = {r = 0, g = 0.5, b = 1, a = 1},
19081910
resourceBarEnabled = true,
19091911
resourceBarFrameLevel = 20,
19101912
resourceBarHeight = 4,
@@ -1916,6 +1918,7 @@ DF.PartyDefaults = {
19161918
resourceBarShowInSoloMode = true,
19171919
resourceBarShowTank = false,
19181920
resourceBarSmooth = true,
1921+
resourceBarTexture = "Interface\\AddOns\\DandersFrames\\Media\\DF_Minimalist",
19191922
resourceBarWidth = 60,
19201923
resourceBarX = 0,
19211924
resourceBarY = 1,
@@ -3491,6 +3494,8 @@ DF.RaidDefaults = {
34913494
WARRIOR = true,
34923495
},
34933496
resourceBarClassColor = false,
3497+
resourceBarColorMode = "POWER_TYPE",
3498+
resourceBarCustomColor = {r = 0, g = 0.5, b = 1, a = 1},
34943499
resourceBarEnabled = true,
34953500
resourceBarFrameLevel = 20,
34963501
resourceBarHeight = 4,
@@ -3502,6 +3507,7 @@ DF.RaidDefaults = {
35023507
resourceBarShowInSoloMode = true,
35033508
resourceBarShowTank = false,
35043509
resourceBarSmooth = true,
3510+
resourceBarTexture = "Interface\\AddOns\\DandersFrames\\Media\\DF_Minimalist",
35053511
resourceBarWidth = 60,
35063512
resourceBarX = 0,
35073513
resourceBarY = 1,

Core.lua

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1777,6 +1777,49 @@ function DF:GetPowerColor(powerToken, powerType)
17771777
return DEFAULT_CLASS_COLOR
17781778
end
17791779

1780+
-- Resolve the resource bar's fill colour for a unit per the configured colour
1781+
-- mode. Returns r, g, b (0-1).
1782+
-- POWER_TYPE → the power-type colour (user override or Blizzard default)
1783+
-- CLASS → the unit's class colour
1784+
-- CUSTOM → the user's resourceBarCustomColor
1785+
-- Honours the legacy resourceBarClassColor boolean when resourceBarColorMode
1786+
-- isn't set yet (pre-migration profiles). Uses the same UnitClass/UnitPowerType
1787+
-- calls the old inline logic did, so it carries no new secret-value risk.
1788+
function DF:GetResourceBarColor(unit, db)
1789+
local mode = db.resourceBarColorMode
1790+
if not mode then
1791+
mode = db.resourceBarClassColor and "CLASS" or "POWER_TYPE"
1792+
end
1793+
1794+
if mode == "CUSTOM" then
1795+
local c = db.resourceBarCustomColor or {r = 0, g = 0.5, b = 1, a = 1}
1796+
return c.r or 0, c.g or 0.5, c.b or 1
1797+
elseif mode == "CLASS" then
1798+
local _, classToken = UnitClass(unit)
1799+
local cc = classToken and DF:GetClassColor(classToken)
1800+
if cc then return cc.r, cc.g, cc.b end
1801+
-- No class colour available — fall through to the power-type colour.
1802+
end
1803+
1804+
-- POWER_TYPE (and the CLASS fallback above)
1805+
local pType, pToken, altR, altG, altB = UnitPowerType(unit)
1806+
local info = DF:GetPowerColor(pToken, pType)
1807+
if info then return info.r, info.g, info.b end
1808+
if altR then return altR, altG, altB end
1809+
return 0, 0, 1
1810+
end
1811+
1812+
-- Migrate the legacy resourceBarClassColor boolean to the new
1813+
-- resourceBarColorMode tri-state. Idempotent; leaves the legacy key in place
1814+
-- (the render helper still honours it as a fallback) — same pattern as the
1815+
-- border-key migrations.
1816+
function DF:MigrateResourceBarColorMode(modeDb)
1817+
if not modeDb then return end
1818+
if modeDb.resourceBarColorMode == nil and modeDb.resourceBarClassColor ~= nil then
1819+
modeDb.resourceBarColorMode = modeDb.resourceBarClassColor and "CLASS" or "POWER_TYPE"
1820+
end
1821+
end
1822+
17801823
-- ============================================================
17811824
-- STATE DRIVERS FOR TEST MODE COMBAT SAFETY
17821825
-- When test mode is active, state drivers are registered on all
@@ -3416,6 +3459,11 @@ DF._MainEventDispatcher = function(self, event, arg1)
34163459
DF:MigrateResourceBarBorderKeys(DF.db.party)
34173460
DF:MigrateResourceBarBorderKeys(DF.db.raid)
34183461
end
3462+
-- Resource Bar: resourceBarClassColor (bool) → resourceBarColorMode (tri-state).
3463+
if DF.MigrateResourceBarColorMode then
3464+
DF:MigrateResourceBarColorMode(DF.db.party)
3465+
DF:MigrateResourceBarColorMode(DF.db.raid)
3466+
end
34193467
-- Aura icons: buff/debuffBorderEnabled → ShowBorder, BorderThickness →
34203468
-- BorderSize (Stage 5.5 Phase 2 — full toolkit for buff/debuff borders).
34213469
if DF.MigrateAuraBorderKeys then

ExportCategories.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ DF.ExportCategories = {
151151

152152
-- Resource/Power Bar
153153
"resourceBarClassColor",
154+
"resourceBarColorMode",
155+
"resourceBarCustomColor",
156+
"resourceBarTexture",
154157
"resourceBarEnabled",
155158
"resourceBarAnchor",
156159
"resourceBarX",

Frames/Bars.lua

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ function DF:ApplyResourceBarLayout(frame)
101101
bar:Show()
102102
bar:ClearAllPoints()
103103

104+
-- Fill texture (configurable; defaults to the DF house texture)
105+
DF:SafeSetStatusBarTexture(bar, db.resourceBarTexture or "Interface\\AddOns\\DandersFrames\\Media\\DF_Minimalist")
106+
104107
-- Orientation & Fill Direction
105108
bar:SetOrientation(db.resourceBarOrientation or "HORIZONTAL")
106109
bar:SetReverseFill(db.resourceBarReverseFill)
@@ -206,19 +209,8 @@ function DF:ApplyResourceBarLayout(frame)
206209
local maxPower = UnitPowerMax(unit)
207210
bar:SetMinMaxValues(0, maxPower)
208211
bar:SetValue(power)
209-
local pType, pToken, altR, altG, altB = UnitPowerType(unit)
210-
local info = DF:GetPowerColor(pToken, pType)
211-
local _, classToken = UnitClass(unit)
212-
local classColor = db.resourceBarClassColor and classToken and DF:GetClassColor(classToken)
213-
if classColor then
214-
bar:SetStatusBarColor(classColor.r, classColor.g, classColor.b, 1)
215-
elseif info then
216-
bar:SetStatusBarColor(info.r, info.g, info.b, 1)
217-
elseif altR then
218-
bar:SetStatusBarColor(altR, altG, altB, 1)
219-
else
220-
bar:SetStatusBarColor(0, 0, 1, 1)
221-
end
212+
local cr, cg, cb = DF:GetResourceBarColor(unit, db)
213+
bar:SetStatusBarColor(cr, cg, cb, 1)
222214
end
223215
end
224216
end
@@ -254,23 +246,9 @@ function DF:UpdateResourceBar(frame)
254246
bar:SetMinMaxValues(0, maxPower)
255247
DF.SetBarValue(bar, power, frame)
256248

257-
-- Get power type for coloring
258-
local pType, pToken, altR, altG, altB = UnitPowerType(unit)
259-
260-
-- Get color from custom overrides or Blizzard defaults
261-
local info = DF:GetPowerColor(pToken, pType)
262-
263-
local _, classToken = UnitClass(unit)
264-
local classColor = db.resourceBarClassColor and classToken and DF:GetClassColor(classToken)
265-
if classColor then
266-
bar:SetStatusBarColor(classColor.r, classColor.g, classColor.b, 1)
267-
elseif info then
268-
bar:SetStatusBarColor(info.r, info.g, info.b, 1)
269-
elseif altR then
270-
bar:SetStatusBarColor(altR, altG, altB, 1)
271-
else
272-
bar:SetStatusBarColor(0, 0, 1, 1) -- Default to blue (mana)
273-
end
249+
-- Resolve fill colour per the configured colour mode (power / class / custom).
250+
local cr, cg, cb = DF:GetResourceBarColor(unit, db)
251+
bar:SetStatusBarColor(cr, cg, cb, 1)
274252
else
275253
bar:Hide()
276254
end

Locales/enUS.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,7 @@ L["Logged Categories"] = true
973973
L["Low"] = true
974974
L["Low Health (0%)"] = true
975975
L["Lunar Power"] = true
976+
L["Maelstrom"] = true
976977
L["Mage"] = true
977978
L["Magic"] = true
978979
L["Major defensive cooldowns like Divine Shield, Ice Block, or Barkskin."] = true
@@ -1270,6 +1271,8 @@ L["Rows"] = true
12701271
L["Rows Grow From"] = true
12711272
L["Run"] = true
12721273
L["Run Script"] = true
1274+
L["Pain"] = true
1275+
L["Power Type"] = true
12731276
L["Run Setup Wizard"] = true
12741277
L["Runic Power"] = true
12751278
L["Runtime"] = true

Options/Options.lua

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3782,8 +3782,24 @@ function DF:SetupGUIPages(GUI, CreateCategory, CreateSubTab, BuildPage)
37823782
local colorGroup = GUI:CreateSettingsGroup(self.child, 280)
37833783
colorGroup:AddWidget(GUI:CreateHeader(self.child, L["Resource Colors"]), 40)
37843784
colorGroup:AddWidget(GUI:CreateLabel(self.child, L["Customize resource bar colors per power type. Shared across party and raid frames."], 260), 40)
3785-
colorGroup:AddWidget(GUI:CreateCheckbox(self.child, L["Use Class Color"], db, "resourceBarClassColor", function() DF:RefreshAllVisibleFrames() end), 30)
3786-
3785+
-- Fill texture (configurable; defaults to the DF house texture).
3786+
colorGroup:AddWidget(GUI:CreateTextureDropdown(self.child, L["Texture"], db, "resourceBarTexture", function() DF:UpdateAllFrames() end), 55)
3787+
3788+
-- Colour mode: Power Type (per-power colours below) / Class / Custom.
3789+
local RESOURCE_COLOR_MODES = {
3790+
POWER_TYPE = L["Power Type"], CLASS = L["Class"], CUSTOM = L["Custom"],
3791+
_order = { "POWER_TYPE", "CLASS", "CUSTOM" },
3792+
}
3793+
colorGroup:AddWidget(GUI:CreateDropdown(self.child, L["Color Mode"], RESOURCE_COLOR_MODES, db, "resourceBarColorMode", function()
3794+
DF:RefreshAllVisibleFrames()
3795+
self:RefreshStates() -- re-evaluate the custom colour picker's hideOn
3796+
end), 54)
3797+
3798+
-- Custom colour — only shown in Custom mode.
3799+
local resourceCustomColor = GUI:CreateColorPicker(self.child, L["Custom Color"], db, "resourceBarCustomColor", false, function() DF:RefreshAllVisibleFrames() end, function() DF:RefreshAllVisibleFrames() end, true)
3800+
resourceCustomColor.hideOn = function() return (db.resourceBarColorMode or "POWER_TYPE") ~= "CUSTOM" end
3801+
colorGroup:AddWidget(resourceCustomColor, 30)
3802+
37873803
local powerColorsDB = DF.db.powerColors
37883804
if not powerColorsDB then
37893805
DF.db.powerColors = {}
@@ -3798,7 +3814,9 @@ function DF:SetupGUIPages(GUI, CreateCategory, CreateSubTab, BuildPage)
37983814
{ token = "RUNIC_POWER", name = L["Runic Power"] },
37993815
{ token = "INSANITY", name = L["Insanity"] },
38003816
{ token = "FURY", name = L["Fury"] },
3817+
{ token = "PAIN", name = L["Pain"] },
38013818
{ token = "LUNAR_POWER", name = L["Lunar Power"] },
3819+
{ token = "MAELSTROM", name = L["Maelstrom"] },
38023820
}
38033821

38043822
for _, info in ipairs(POWER_LIST) do

0 commit comments

Comments
 (0)