Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 39 additions & 1 deletion EllesmereUIRaidFrames/EUI_RaidFrames_Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -911,9 +911,33 @@ initFrame:SetScript("OnEvent", function(self)
EllesmereUI.RegisterWidgetRefresh(UpdateSwatchVis)
UpdateSwatchVis()
end
-- Inline swatch for custom bg color
-- Inline swatches for background: Custom + Class pair. Clicking either
-- toggles bgClassColored; the inactive one dims (mirrors the fill picker).
do
local rgn = row._rightRegion
-- Class-colored background swatch (player class color; not editable).
local bgClassSwatch = EllesmereUI.BuildColorSwatch(
rgn, row:GetFrameLevel() + 3,
function()
local _, ct = UnitClass("player")
local cc = ct and EllesmereUI.GetClassColor(ct)
if cc then return cc.r, cc.g, cc.b, 1 end
return 1, 1, 1, 1
end,
function() end, false, 20)
bgClassSwatch:SetScript("OnClick", function()
SSet("bgClassColored", true)
ReloadAndUpdate(); EllesmereUI:RefreshPage()
end)
bgClassSwatch:HookScript("OnEnter", function() EllesmereUI.ShowWidgetTooltip(bgClassSwatch, "Class Colored Background") end)
bgClassSwatch:HookScript("OnLeave", function() EllesmereUI.HideWidgetTooltip() end)
bgClassSwatch:SetPoint("RIGHT", rgn._lastInline or rgn._control, "LEFT", -8, 0)
rgn._lastInline = bgClassSwatch
EllesmereUI.RegisterWidgetRefresh(function()
bgClassSwatch:SetAlpha(SVal("bgClassColored", false) and 1 or 0.3)
end)

-- Custom background color swatch.
local bgSwatch = EllesmereUI.BuildColorSwatch(
rgn, row:GetFrameLevel() + 3,
function()
Expand All @@ -925,8 +949,22 @@ initFrame:SetScript("OnEvent", function(self)
SWrite("customBgColor", { r=r, g=g, b=b })
ReloadAndUpdate()
end, false, 20)
bgSwatch._eabOrigClick = bgSwatch:GetScript("OnClick")
bgSwatch:SetScript("OnClick", function(self)
if SVal("bgClassColored", false) then
SSet("bgClassColored", false)
ReloadAndUpdate(); EllesmereUI:RefreshPage()
return
end
if self._eabOrigClick then self._eabOrigClick(self) end
end)
Comment on lines +952 to +960
bgSwatch:HookScript("OnEnter", function() EllesmereUI.ShowWidgetTooltip(bgSwatch, "Custom Background Color") end)
bgSwatch:HookScript("OnLeave", function() EllesmereUI.HideWidgetTooltip() end)
bgSwatch:SetPoint("RIGHT", rgn._lastInline or rgn._control, "LEFT", -8, 0)
rgn._lastInline = bgSwatch
EllesmereUI.RegisterWidgetRefresh(function()
bgSwatch:SetAlpha(SVal("bgClassColored", false) and 0.3 or 1)
end)
end

ns._editTargets = ns._editTargets or {}
Expand Down
51 changes: 40 additions & 11 deletions EllesmereUIRaidFrames/EllesmereUIRaidFrames.lua
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ local defaults = {
healthColorMode = "class", -- "class", "dark", "classic", "custom"
customFillColor = { r = 37/255, g = 193/255, b = 29/255 },
customBgColor = { r = 17/255, g = 17/255, b = 17/255 },
bgClassColored = false,
bgDarkness = 50,

-- Power bar (on when any powerShowFor* role is true)
Expand Down Expand Up @@ -1050,6 +1051,25 @@ local function ResolveDisplayName(unit)
return name
end

-- Background color: class color when bgClassColored, else the custom bg color.
-- Returns r, g, b, a (alpha = bgDarkness). Mirrors the health-fill class option.
function ns.GetBgColor(unit, s)
s = s or db.profile
local a = (s.bgDarkness or 50) / 100
if s.bgClassColored and unit and UnitExists(unit) then
local _, classToken = UnitClass(unit)
-- classToken can be a secret value (out-of-range/uninspectable units);
-- indexing GetClassColor's tables with a secret throws "table index is
-- secret". Guard it and fall back to the custom bg color when secret/nil.
if classToken and not issecretvalue(classToken) then
local cc = EllesmereUI.GetClassColor(classToken)
if cc then return cc.r, cc.g, cc.b, a end
end
end
local c = s.customBgColor
return c.r, c.g, c.b, a
end

local function GetNameColor(unit, s)
s = s or db.profile
local mode = s.nameColorMode or "class"
Expand Down Expand Up @@ -2488,8 +2508,7 @@ local function UpdateButton(button)
d.bg:ClearAllPoints()
d.bg:SetPoint("TOPLEFT", health:GetStatusBarTexture(), "TOPRIGHT", 0, 0)
d.bg:SetPoint("BOTTOMRIGHT", health, "BOTTOMRIGHT", 0, 0)
local bgc = s.customBgColor
d.bg:SetColorTexture(bgc.r, bgc.g, bgc.b, (s.bgDarkness or 50) / 100)
d.bg:SetColorTexture(ns.GetBgColor(unit, s))
end
end

Expand Down Expand Up @@ -3826,7 +3845,7 @@ ns._UpdateButtonHealth = function(button)
local s = d._isParty and ns._scaledPartyProxy or ns._scaledProfile

local health = d.health
local pct = GetSafeHealthPercent(unit)
local pct = GetSafeHealthPercent(unit) -- for the health TEXT below

-- Health bar
if health then
Expand Down Expand Up @@ -4544,8 +4563,7 @@ local function ReloadFrames()

-- Background
if d.bg then
local bgc = s.customBgColor
d.bg:SetColorTexture(bgc.r, bgc.g, bgc.b, (s.bgDarkness or 50) / 100)
d.bg:SetColorTexture(ns.GetBgColor(btn:GetAttribute("unit"), s))
end

-- Health bar
Expand Down Expand Up @@ -5553,7 +5571,7 @@ do
local map = {
healthBar = {
"healthBarTexture", "healthBarOpacity", "healthColorMode",
"customFillColor", "customBgColor", "bgDarkness", "smoothBars",
"customFillColor", "customBgColor", "bgClassColored", "bgDarkness", "smoothBars",
"absorbStyle", "absorbOpacity", "absorbColor", "absorbFromRightEdge",
"healAbsorbStyle", "healAbsorbOpacity", "healAbsorbColor",
"healPrediction", "healPredOpacity", "healPredColor",
Expand Down Expand Up @@ -7907,8 +7925,14 @@ local function ApplyPreviewData(f, index)
f._bg:ClearAllPoints()
f._bg:SetPoint("TOPLEFT", f._health:GetStatusBarTexture(), "TOPRIGHT", 0, 0)
f._bg:SetPoint("BOTTOMRIGHT", f._health, "BOTTOMRIGHT", 0, 0)
local bgc = s.customBgColor
f._bg:SetColorTexture(bgc.r, bgc.g, bgc.b, (s.bgDarkness or 50) / 100)
local bgA = (s.bgDarkness or 50) / 100
local cc = s.bgClassColored and classToken and EllesmereUI.GetClassColor(classToken)
if cc then
f._bg:SetColorTexture(cc.r, cc.g, cc.b, bgA)
else
local bgc = s.customBgColor
f._bg:SetColorTexture(bgc.r, bgc.g, bgc.b, bgA)
end
end
end

Expand Down Expand Up @@ -9413,9 +9437,14 @@ ns._ShowSizePreview = function(tier)
local cc = EllesmereUI.GetClassColor(ct)
if cc then f._health:SetStatusBarColor(cc.r, cc.g, cc.b) end

-- Background
local bgc = s.customBgColor or { r = 17/255, g = 17/255, b = 17/255 }
f._bg:SetColorTexture(bgc.r, bgc.g, bgc.b, (s.bgDarkness or 50) / 100)
-- Background (class-colored when enabled, using this sample's class)
local bgA = (s.bgDarkness or 50) / 100
if s.bgClassColored and cc then
f._bg:SetColorTexture(cc.r, cc.g, cc.b, bgA)
else
local bgc = s.customBgColor or { r = 17/255, g = 17/255, b = 17/255 }
f._bg:SetColorTexture(bgc.r, bgc.g, bgc.b, bgA)
end

-- Power bar with class-accurate color
if f._power then
Expand Down
103 changes: 91 additions & 12 deletions EllesmereUIUnitFrames/EUI_UnitFrames_Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -985,12 +985,22 @@ initFrame:SetScript("OnEvent", function(self)
else
hR, hG, hB = 0.8, 0.2, 0.2
end
-- Check for custom background color
local cBg = settings.customBgColor
if cBg then
bgR, bgG, bgB = cBg.r, cBg.g, cBg.b
-- Class-colored background (designer shows the player's class), else custom.
-- Inhibited when the fill is class colored (same color).
local bgClassCC
if settings.bgClassColored and not settings.healthClassColored then
local _, ct = UnitClass("player")
bgClassCC = ct and EllesmereUI.GetClassColor(ct)
end
if bgClassCC then
bgR, bgG, bgB = bgClassCC.r, bgClassCC.g, bgClassCC.b
else
bgR, bgG, bgB = 17/255, 17/255, 17/255
local cBg = settings.customBgColor
if cBg then
bgR, bgG, bgB = cBg.r, cBg.g, cBg.b
else
bgR, bgG, bgB = 17/255, 17/255, 17/255
end
end
bgA = (settings.customBgAlpha or 100) / 100
end
Expand Down Expand Up @@ -1990,12 +2000,22 @@ initFrame:SetScript("OnEvent", function(self)
else
uHR, uHG, uHB = 0.8, 0.2, 0.2
end
-- Check for custom background color
local cBg = s.customBgColor
if cBg then
uBgR, uBgG, uBgB = cBg.r, cBg.g, cBg.b
-- Class-colored background (designer shows the player's class), else custom.
-- Inhibited when the fill is class colored (same color).
local uBgClassCC
if s.bgClassColored and not s.healthClassColored then
local _, ct = UnitClass("player")
uBgClassCC = ct and EllesmereUI.GetClassColor(ct)
end
if uBgClassCC then
uBgR, uBgG, uBgB = uBgClassCC.r, uBgClassCC.g, uBgClassCC.b
else
uBgR, uBgG, uBgB = 17/255, 17/255, 17/255
local cBg = s.customBgColor
if cBg then
uBgR, uBgG, uBgB = cBg.r, cBg.g, cBg.b
else
uBgR, uBgG, uBgB = 17/255, 17/255, 17/255
end
end
end
healthFill:SetColorTexture(uHR, uHG, uHB, 1)
Expand Down Expand Up @@ -4410,6 +4430,9 @@ initFrame:SetScript("OnEvent", function(self)
setValue = function() end,
onClick = function()
SSet("healthClassColored", true)
-- Class fill and class bg would be the same color; turning on
-- class fill inhibits class bg.
SSet("bgClassColored", false)
UpdatePreview()
EllesmereUI:RefreshPage()
end,
Expand All @@ -4420,9 +4443,48 @@ initFrame:SetScript("OnEvent", function(self)
{ type="slider", text="Bar Background", min=0, max=100, step=1,
getValue=function() return SVal("customBgAlpha", 100) end,
setValue=function(v) SSet("customBgAlpha", v); ReloadAndUpdate(); UpdatePreview() end }); y = y - h
-- Inline color swatch on Bar Background (right region)
-- Inline color swatches on Bar Background (right region): a Custom + Class
-- pair mirroring the Bar Color picker. Clicking either toggles bgClassColored;
-- the inactive one dims to 0.3 (matches the fill swatch behavior).
do
local rgn = sharedHealthColorRow._rightRegion
-- Class-colored background swatch (shows player class color; not editable).
local bgClassGet = function()
local _, ct = UnitClass("player")
local cc = ct and RAID_CLASS_COLORS[ct]
if cc then return cc.r, cc.g, cc.b end
return 1, 1, 1
end
-- Class bg conflicts with class fill (same color), so it is inhibited
-- while the Bar Color is class colored.
local function bgClassInhibited() return SVal("healthClassColored", true) end
local bgClassSw, bgClassUpdate = EllesmereUI.BuildColorSwatch(rgn, rgn:GetFrameLevel() + 5, bgClassGet, function() end, false, 20)
bgClassSw._eabOrigClick = bgClassSw:GetScript("OnClick")
bgClassSw:SetScript("OnClick", function()
if bgClassInhibited() then return end
SSet("bgClassColored", true)
ReloadAndUpdate(); UpdatePreview(); EllesmereUI:RefreshPage()
end)
Comment on lines +4465 to +4467
bgClassSw:HookScript("OnEnter", function()
if bgClassInhibited() then
EllesmereUI.ShowWidgetTooltip(bgClassSw, "Unavailable while Bar Color is class colored")
else
EllesmereUI.ShowWidgetTooltip(bgClassSw, "Class Colored Background")
end
end)
bgClassSw:HookScript("OnLeave", function() EllesmereUI.HideWidgetTooltip() end)
PP.Point(bgClassSw, "RIGHT", rgn._lastInline or rgn._control, "LEFT", -8, 0)
rgn._lastInline = bgClassSw
RegisterWidgetRefresh(function()
bgClassUpdate()
if bgClassInhibited() then
bgClassSw:SetAlpha(0.3)
else
bgClassSw:SetAlpha(SVal("bgClassColored", false) and 1 or 0.3)
end
end)

-- Custom background color swatch.
local bgSwGet = function()
local c = SGet("customBgColor")
if c then return c.r, c.g, c.b end
Expand All @@ -4433,9 +4495,23 @@ initFrame:SetScript("OnEvent", function(self)
ReloadAndUpdate(); UpdatePreview()
end
local bgSw, bgSwUpdate = EllesmereUI.BuildColorSwatch(rgn, rgn:GetFrameLevel() + 5, bgSwGet, bgSwSet, false, 20)
bgSw._eabOrigClick = bgSw:GetScript("OnClick")
bgSw:SetScript("OnClick", function(self)
if SVal("bgClassColored", false) then
SSet("bgClassColored", false)
ReloadAndUpdate(); UpdatePreview(); EllesmereUI:RefreshPage()
return
end
if self._eabOrigClick then self._eabOrigClick(self) end
end)
Comment on lines +4498 to +4506
bgSw:HookScript("OnEnter", function() EllesmereUI.ShowWidgetTooltip(bgSw, "Custom Background Color") end)
bgSw:HookScript("OnLeave", function() EllesmereUI.HideWidgetTooltip() end)
PP.Point(bgSw, "RIGHT", rgn._lastInline or rgn._control, "LEFT", -8, 0)
rgn._lastInline = bgSw
RegisterWidgetRefresh(function() bgSwUpdate() end)
RegisterWidgetRefresh(function()
bgSwUpdate()
bgSw:SetAlpha(SVal("bgClassColored", false) and 0.3 or 1)
end)
end
-- Sync icon: Bar Background (right) -- background color + opacity
do
Expand All @@ -4444,11 +4520,13 @@ initFrame:SetScript("OnEvent", function(self)
local src = UNIT_DB_MAP[selectedUnit]()
local bc = src.customBgColor or { r=17/255, g=17/255, b=17/255 }
local bgA = src.customBgAlpha or 100
local bgClass = src.bgClassColored or false
for _, key in ipairs(keys) do
if key ~= selectedUnit then
local d = UNIT_DB_MAP[key]()
d.customBgColor = { r=bc.r, g=bc.g, b=bc.b }
d.customBgAlpha = bgA
d.bgClassColored = bgClass
end
end
ReloadAndUpdate(); EllesmereUI:RefreshPage()
Expand All @@ -4468,6 +4546,7 @@ initFrame:SetScript("OnEvent", function(self)
local d = UNIT_DB_MAP[key]()
if not colEq(d.customBgColor, src.customBgColor) then return false end
if (d.customBgAlpha or 100) ~= (src.customBgAlpha or 100) then return false end
if (d.bgClassColored or false) ~= (src.bgClassColored or false) then return false end
end
return true
end,
Expand Down
Loading
Loading