diff --git a/IceBarElement.lua b/IceBarElement.lua index 0b9edc4..0754594 100644 --- a/IceBarElement.lua +++ b/IceBarElement.lua @@ -632,7 +632,7 @@ do disabled = function() return not self.moduleSettings.enabled end, - multiline = true, + multiline = self.moduleSettings.usesDogTagStrings, usage = "", order = 13.2, }, @@ -661,7 +661,7 @@ do disabled = function() return not self.moduleSettings.enabled end, - multiline = true, + multiline = self.moduleSettings.usesDogTagStrings, usage = "", order = 14.2, }, @@ -1345,7 +1345,9 @@ function IceBarElement.prototype:SetBottomText1(text, color) alpha = 1 end - self.frame.bottomUpperText:SetTextColor(self:GetColor(color, alpha)) + if not self.textColorOverride then + self.frame.bottomUpperText:SetTextColor(self:GetColor(color, alpha)) + end self.frame.bottomUpperText:SetText(text) self.frame.bottomUpperText:SetWidth(0) end @@ -1375,11 +1377,20 @@ function IceBarElement.prototype:SetBottomText2(text, color, alpha) alpha = 1 end - self.frame.bottomLowerText:SetTextColor(self:GetColor(color, alpha)) + if not self.textColorOverride then + self.frame.bottomLowerText:SetTextColor(self:GetColor(color, alpha)) + end self.frame.bottomLowerText:SetText(text) self.frame.bottomLowerText:SetWidth(0) end +function IceBarElement.prototype:SetCustomTextColor(fontInstance, colorTable) + if not fontInstance or not colorTable or type(colorTable) ~= "table" then + return + end + + fontInstance:SetTextColor(colorTable.r, colorTable.g, colorTable.b) +end function IceBarElement.prototype:SetTextAlpha() if self.frame.bottomUpperText then diff --git a/modules/CustomBar.lua b/modules/CustomBar.lua index 7ec22fe..fc74591 100644 --- a/modules/CustomBar.lua +++ b/modules/CustomBar.lua @@ -16,6 +16,7 @@ IceCustomBar.prototype.bIsAura = false -- Constructor -- function IceCustomBar.prototype:init() IceCustomBar.super.prototype.init(self, "MyCustomBar", "player") + self.textColorOverride = true end -- 'Public' methods ----------------------------------------------------------- @@ -49,6 +50,15 @@ function IceCustomBar.prototype:Enable(core) if self.moduleSettings.auraIconYOffset == nil then self.moduleSettings.auraIconYOffset = 0 end + + if not self.moduleSettings.upperTextColor then + self.moduleSettings.upperTextColor = {r=1, g=1, b=1} + end + self:SetCustomTextColor(self.frame.bottomUpperText, self.moduleSettings.upperTextColor) + if not self.moduleSettings.lowerTextColor then + self.moduleSettings.lowerTextColor = {r=1, g=1, b=1} + end + self:SetCustomTextColor(self.frame.bottomLowerText, self.moduleSettings.lowerTextColor) end function IceCustomBar.prototype:ConditionalSubscribe() @@ -111,6 +121,8 @@ function IceCustomBar.prototype:GetDefaultSettings() settings["auraIconYOffset"] = 0 settings["auraIconScale"] = 1 settings["exactMatch"] = false + settings["lowerTextColor"] = {r=1, g=1, b=1} + settings["upperTextColor"] = {r=1, g=1, b=1} return settings end @@ -479,6 +491,42 @@ function IceCustomBar.prototype:GetOptions() }, } + opts.textSettings.args.upperTextColor = { + type = "color", + name = L["Upper Text Color"], + get = function() + return self.moduleSettings.upperTextColor.r, self.moduleSettings.upperTextColor.g, self.moduleSettings.upperTextColor.b, 1 + end, + set = function(info, r,g,b) + self.moduleSettings.upperTextColor.r = r + self.moduleSettings.upperTextColor.g = g + self.moduleSettings.upperTextColor.b = b + self:SetCustomTextColor(self.frame.bottomUpperText, self.moduleSettings.upperTextColor) + end, + disabled = function() + return not self.moduleSettings.enabled + end, + order = 13.9, + } + + opts.textSettings.args.lowerTextColor = { + type = "color", + name = L["Lower Text Color"], + get = function() + return self.moduleSettings.lowerTextColor.r, self.moduleSettings.lowerTextColor.g, self.moduleSettings.lowerTextColor.b, 1 + end, + set = function(info, r,g,b) + self.moduleSettings.lowerTextColor.r = r + self.moduleSettings.lowerTextColor.g = g + self.moduleSettings.lowerTextColor.b = b + self:SetCustomTextColor(self.frame.bottomLowerText, self.moduleSettings.lowerTextColor) + end, + disabled = function() + return not self.moduleSettings.enabled + end, + order = 14.9, + } + return opts end @@ -656,6 +704,8 @@ function IceCustomBar.prototype:UpdateCustomBar(unit, fromUpdate) self:SetBottomText1(self.moduleSettings.upperText) end + self:SetBottomText2(self.moduleSettings.lowerText) + self.barFrame.bar:SetVertexColor(self:GetBarColor()) if self.flashFrame and self.flashFrame.flash then self.flashFrame.flash:SetVertexColor(self:GetBarColor()) diff --git a/modules/CustomCDBar.lua b/modules/CustomCDBar.lua index 37e86b2..951f7c8 100644 --- a/modules/CustomCDBar.lua +++ b/modules/CustomCDBar.lua @@ -19,6 +19,7 @@ table.insert(brokenSpellsNameToId, {"Holy Word: Aspire",88682}) -- Constructor -- function IceCustomCDBar.prototype:init() IceCustomCDBar.super.prototype.init(self, "MyCustomCDBar") + self.textColorOverride = true end -- 'Public' methods ----------------------------------------------------------- @@ -55,6 +56,15 @@ function IceCustomCDBar.prototype:Enable(core) end self.moduleSettings.displayWhenEmpty = nil end + + if not self.moduleSettings.upperTextColor then + self.moduleSettings.upperTextColor = {r=1, g=1, b=1} + end + self:SetCustomTextColor(self.frame.bottomUpperText, self.moduleSettings.upperTextColor) + if not self.moduleSettings.lowerTextColor then + self.moduleSettings.lowerTextColor = {r=1, g=1, b=1} + end + self:SetCustomTextColor(self.frame.bottomLowerText, self.moduleSettings.lowerTextColor) end @@ -90,6 +100,8 @@ function IceCustomCDBar.prototype:GetDefaultSettings() settings["auraIconXOffset"] = 40 settings["auraIconYOffset"] = 0 settings["auraIconScale"] = 1 + settings["lowerTextColor"] = {r=1, g=1, b=1} + settings["upperTextColor"] = {r=1, g=1, b=1} return settings end @@ -376,6 +388,42 @@ function IceCustomCDBar.prototype:GetOptions() }, } + opts.textSettings.args.upperTextColor = { + type = "color", + name = L["Upper Text Color"], + get = function() + return self.moduleSettings.upperTextColor.r, self.moduleSettings.upperTextColor.g, self.moduleSettings.upperTextColor.b, 1 + end, + set = function(info, r,g,b) + self.moduleSettings.upperTextColor.r = r + self.moduleSettings.upperTextColor.g = g + self.moduleSettings.upperTextColor.b = b + self:SetCustomTextColor(self.frame.bottomUpperText, self.moduleSettings.upperTextColor) + end, + disabled = function() + return not self.moduleSettings.enabled + end, + order = 13.9, + } + + opts.textSettings.args.lowerTextColor = { + type = "color", + name = L["Lower Text Color"], + get = function() + return self.moduleSettings.lowerTextColor.r, self.moduleSettings.lowerTextColor.g, self.moduleSettings.lowerTextColor.b, 1 + end, + set = function(info, r,g,b) + self.moduleSettings.lowerTextColor.r = r + self.moduleSettings.lowerTextColor.g = g + self.moduleSettings.lowerTextColor.b = b + self:SetCustomTextColor(self.frame.bottomLowerText, self.moduleSettings.lowerTextColor) + end, + disabled = function() + return not self.moduleSettings.enabled + end, + order = 14.9, + } + return opts end @@ -536,6 +584,8 @@ function IceCustomCDBar.prototype:UpdateCustomBar(fromUpdate) self:SetBottomText1(self.moduleSettings.upperText) end + self:SetBottomText2(self.moduleSettings.lowerText) + self:UpdateAlpha() self.barFrame.bar:SetVertexColor(self:GetBarColor())