From d288be9572db6130f726d2b0dcd70b9067ddc403 Mon Sep 17 00:00:00 2001 From: Aleksi Blinnikka Date: Thu, 28 Dec 2017 18:54:32 +0200 Subject: [PATCH] Add icon tinting --- Core.lua | 5 +++-- Indicators.lua | 3 ++- IndicatorsConfig.lua | 17 ++++++++++++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Core.lua b/Core.lua index ad8d6b3..cb4134f 100644 --- a/Core.lua +++ b/Core.lua @@ -18,13 +18,14 @@ local defaults = { indicators = { ['**'] = { textSize = 10, - color = {1, 1, 1, 1}, + textColor = {1, 1, 1, 1}, mine = false, stack = true, showText = true, showIcon = true, useDefaultIcon = true, iconSize = 10, + iconColor = {1, 1, 1, 1}, }, }, } @@ -32,10 +33,10 @@ local defaults = { function RaidFrameCustomization:OnInitialize() self.db = LibStub("AceDB-3.0"):New("RaidFrameCustomizationDB", defaults); - self:SetupOptions(); self.db.RegisterCallback(self, "OnProfileChanged", "RefreshConfig"); self.db.RegisterCallback(self, "OnProfileCopied", "RefreshConfig"); self.db.RegisterCallback(self, "OnProfileReset", "RefreshConfig"); + self:SetupOptions(); end function RaidFrameCustomization:OnEnable() diff --git a/Indicators.lua b/Indicators.lua index 22712f2..ce916a6 100644 --- a/Indicators.lua +++ b/Indicators.lua @@ -36,10 +36,11 @@ local function configureIndicators(frame) local font = media and media:Fetch('font', config.indicatorFont) or STANDARD_TEXT_FONT; for pos, ind in pairs(f[frameName]) do ind.text:SetFont(font, config[pos]["textSize"]); - ind.text:SetTextColor(unpack(config[pos]["color"])); + ind.text:SetTextColor(unpack(config[pos]["textColor"])); ind.icon:SetWidth(config[pos]["iconSize"]); ind.icon:SetHeight(config[pos]["iconSize"]); ind.icon:SetTexture(DEFAULT_ICON); + ind.icon:SetVertexColor(unpack(config[pos]["iconColor"])); if config[pos]["showIcon"] then ind.icon:Show(); else diff --git a/IndicatorsConfig.lua b/IndicatorsConfig.lua index 958fa59..5cbd343 100644 --- a/IndicatorsConfig.lua +++ b/IndicatorsConfig.lua @@ -66,14 +66,14 @@ local function createOptionsTable(self) step = 1, width = "full", }, - color = { + textColor = { type = "color", name = "Text color", get = function(item) - return unpack(self.db.profile[pos]["color"]); + return unpack(self.db.profile[pos]["textColor"]); end, set = function(item, r, g, b, a) - self.db.profile[pos]["color"] = {r, g, b, a}; + self.db.profile[pos]["textColor"] = {r, g, b, a}; self:RefreshConfig(); end, }, @@ -98,6 +98,17 @@ local function createOptionsTable(self) step = 1, width = "full", }, + iconColor = { + type = "color", + name = "Icon tint", + get = function(item) + return unpack(self.db.profile[pos]["iconColor"]); + end, + set = function(item, r, g, b, a) + self.db.profile[pos]["iconColor"] = {r, g, b, a}; + self:RefreshConfig(); + end, + }, } }; end -- 2.39.5