diff --git a/DarkMode.toc b/DarkMode.toc index 40c8c76..ece92a5 100644 --- a/DarkMode.toc +++ b/DarkMode.toc @@ -4,7 +4,7 @@ ## Interface-Cata: 40400 ## Interface: 100207, 110000 -## Version: 0.5.49 +## Version: 0.5.50 ## Title: DarkMode by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/DarkMode_Cata.toc b/DarkMode_Cata.toc index a626a9e..1985fb5 100644 --- a/DarkMode_Cata.toc +++ b/DarkMode_Cata.toc @@ -1,5 +1,5 @@ ## Interface: 40400 -## Version: 0.5.49 +## Version: 0.5.50 ## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/DarkMode_TBC.toc b/DarkMode_TBC.toc index 10ed8c5..0fb91cc 100644 --- a/DarkMode_TBC.toc +++ b/DarkMode_TBC.toc @@ -1,5 +1,5 @@ ## Interface: 20504 -## Version: 0.5.49 +## Version: 0.5.50 ## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/DarkMode_Vanilla.toc b/DarkMode_Vanilla.toc index c2ff00f..5055e70 100644 --- a/DarkMode_Vanilla.toc +++ b/DarkMode_Vanilla.toc @@ -1,5 +1,5 @@ ## Interface: 11502 -## Version: 0.5.49 +## Version: 0.5.50 ## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/DarkMode_Wrath.toc b/DarkMode_Wrath.toc index 009995b..4af03e3 100644 --- a/DarkMode_Wrath.toc +++ b/DarkMode_Wrath.toc @@ -1,5 +1,5 @@ ## Interface: 30403 -## Version: 0.5.49 +## Version: 0.5.50 ## Title: DarkMode |T136122:16:16:0:0|t by |cff3FC7EBD4KiR |T132115:16:16:0:0|t ## Notes: Improve Any Ui or Frame ## Author: D4KiR diff --git a/core.lua b/core.lua index fbc3f10..4749a9d 100644 --- a/core.lua +++ b/core.lua @@ -38,7 +38,7 @@ function DarkMode:UpdateColor(texture, typ, show) if texture:GetAlpha() == 0 then return false end if textureId == nil and texture.SetColorTexture then if typ == "ui" then - local r, g, b, a = DarkMode:GetUiColor() + local r, g, b, a = DarkMode:GetUiColor(texture) if r ~= nil and g ~= nil and b ~= nil then if texture:GetAlpha() < 1 then a = texture:GetAlpha() @@ -47,7 +47,7 @@ function DarkMode:UpdateColor(texture, typ, show) texture:SetColorTexture(r, g, b, a) end elseif typ == "uf" then - local r, g, b, a = DarkMode:GetUFColor() + local r, g, b, a = DarkMode:GetUFColor(texture) if r ~= nil and g ~= nil and b ~= nil then if texture:GetAlpha() < 1 then a = texture:GetAlpha() @@ -56,7 +56,7 @@ function DarkMode:UpdateColor(texture, typ, show) texture:SetColorTexture(r, g, b, a) end elseif typ == "np" then - local r, g, b, a = DarkMode:GetNPColor() + local r, g, b, a = DarkMode:GetNPColort(texture) if r ~= nil and g ~= nil and b ~= nil then if texture:GetAlpha() < 1 then a = texture:GetAlpha() @@ -65,7 +65,7 @@ function DarkMode:UpdateColor(texture, typ, show) texture:SetColorTexture(r, g, b, a) end elseif typ == "tt" then - local r, g, b, a = DarkMode:GetTTColor() + local r, g, b, a = DarkMode:GetTTColor(texture) if r ~= nil and g ~= nil and b ~= nil then if texture:GetAlpha() < 1 then a = texture:GetAlpha() @@ -74,7 +74,7 @@ function DarkMode:UpdateColor(texture, typ, show) texture:SetColorTexture(r, g, b, a) end elseif typ == "actionbuttons" then - local r, g, b, a = DarkMode:GetActionButtonsColor() + local r, g, b, a = DarkMode:GetActionButtonsColor(texture) if r ~= nil and g ~= nil and b ~= nil then if texture:GetAlpha() < 1 then a = texture:GetAlpha() @@ -83,7 +83,7 @@ function DarkMode:UpdateColor(texture, typ, show) texture:SetColorTexture(r, g, b, a) end elseif typ == "buffsanddebuffs" then - local r, g, b, a = DarkMode:GetBuffsAndDebuffsColor() + local r, g, b, a = DarkMode:GetBuffsAndDebuffsColor(texture) if r ~= nil and g ~= nil and b ~= nil then if texture:GetAlpha() < 1 then a = texture:GetAlpha() @@ -92,7 +92,7 @@ function DarkMode:UpdateColor(texture, typ, show) texture:SetColorTexture(r, g, b, a) end else - local r, g, b, a = DarkMode:GetFrameColor() + local r, g, b, a = DarkMode:GetFrameColor(texture) if r ~= nil and g ~= nil and b ~= nil then if texture:GetAlpha() < 1 then a = texture:GetAlpha() @@ -114,37 +114,37 @@ function DarkMode:UpdateColor(texture, typ, show) if sel.dm_setvertexcolor then return end sel.dm_setvertexcolor = true if typ == "ui" then - local r, g, b, a = DarkMode:GetUiColor() + local r, g, b, a = DarkMode:GetUiColor(sel) if r ~= nil and g ~= nil and b ~= nil then sel:SetVertexColor(r, g, b, a) end elseif typ == "uf" then - local r, g, b, a = DarkMode:GetUFColor() + local r, g, b, a = DarkMode:GetUFColor(sel) if r ~= nil and g ~= nil and b ~= nil then sel:SetVertexColor(r, g, b, a) end elseif typ == "np" then - local r, g, b, a = DarkMode:GetNPColor() + local r, g, b, a = DarkMode:GetNPColor(sel) if r ~= nil and g ~= nil and b ~= nil then sel:SetVertexColor(r, g, b, a) end elseif typ == "tt" then - local r, g, b, a = DarkMode:GetTTColor() + local r, g, b, a = DarkMode:GetTTColor(sel) if r ~= nil and g ~= nil and b ~= nil then sel:SetVertexColor(r, g, b, a) end elseif typ == "actionbuttons" then - local r, g, b, a = DarkMode:GetActionButtonsColor() + local r, g, b, a = DarkMode:GetActionButtonsColor(sel) if r ~= nil and g ~= nil and b ~= nil then sel:SetVertexColor(r, g, b, a) end elseif typ == "buffsanddebuffs" then - local r, g, b, a = DarkMode:GetBuffsAndDebuffsColor() + local r, g, b, a = DarkMode:GetBuffsAndDebuffsColor(sel) if r ~= nil and g ~= nil and b ~= nil then sel:SetVertexColor(r, g, b, a) end else - local r, g, b, a = DarkMode:GetFrameColor() + local r, g, b, a = DarkMode:GetFrameColor(sel) if r ~= nil and g ~= nil and b ~= nil then sel:SetVertexColor(r, g, b, a) end @@ -156,37 +156,37 @@ function DarkMode:UpdateColor(texture, typ, show) end if typ == "ui" then - local r, g, b, a = DarkMode:GetUiColor() + local r, g, b, a = DarkMode:GetUiColor(texture) if r ~= nil and g ~= nil and b ~= nil then texture:SetVertexColor(r, g, b, a) end elseif typ == "uf" then - local r, g, b, a = DarkMode:GetUFColor() + local r, g, b, a = DarkMode:GetUFColor(texture) if r ~= nil and g ~= nil and b ~= nil then texture:SetVertexColor(r, g, b, a) end elseif typ == "np" then - local r, g, b, a = DarkMode:GetNPColor() + local r, g, b, a = DarkMode:GetNPColor(texture) if r ~= nil and g ~= nil and b ~= nil then texture:SetVertexColor(r, g, b, a) end elseif typ == "tt" then - local r, g, b, a = DarkMode:GetTTColor() + local r, g, b, a = DarkMode:GetTTColor(texture) if r ~= nil and g ~= nil and b ~= nil then texture:SetVertexColor(r, g, b, a) end elseif typ == "actionbuttons" then - local r, g, b, a = DarkMode:GetActionButtonsColor() + local r, g, b, a = DarkMode:GetActionButtonsColor(texture) if r ~= nil and g ~= nil and b ~= nil then texture:SetVertexColor(r, g, b, a) end elseif typ == "buffsanddebuffs" then - local r, g, b, a = DarkMode:GetBuffsAndDebuffsColor() + local r, g, b, a = DarkMode:GetBuffsAndDebuffsColor(texture) if r ~= nil and g ~= nil and b ~= nil then texture:SetVertexColor(r, g, b, a) end else - local r, g, b, a = DarkMode:GetFrameColor() + local r, g, b, a = DarkMode:GetFrameColor(texture) if r ~= nil and g ~= nil and b ~= nil then texture:SetVertexColor(r, g, b, a) end @@ -360,21 +360,21 @@ end function DarkMode:UpdateColors() for i, v in pairs(DMTexturesUi) do - local r, g, b, a = DarkMode:GetUiColor() + local r, g, b, a = DarkMode:GetUiColor(v) if r ~= nil and g ~= nil and b ~= nil then v:SetVertexColor(r, g, b, a) end end for i, v in pairs(DMTexturesUF) do - local r, g, b, a = DarkMode:GetUFColor() + local r, g, b, a = DarkMode:GetUFColor(v) if r ~= nil and g ~= nil and b ~= nil then v:SetVertexColor(r, g, b, a) end end for i, v in pairs(DMTexturesTT) do - local r, g, b, a = DarkMode:GetTTColor() + local r, g, b, a = DarkMode:GetTTColor(v) if r ~= nil and g ~= nil and b ~= nil then v:SetVertexColor(r, g, b, a) end @@ -382,14 +382,14 @@ function DarkMode:UpdateColors() -- FONTSTRINGS for i, v in pairs(DMFS) do - local r, g, b, a = DarkMode:GetFrameColor() + local r, g, b, a = DarkMode:GetFrameColor(v) if r ~= nil and g ~= nil and b ~= nil then v:SetVertexColor(r, g, b, a) end end for i, v in pairs(DMTexturesFrames) do - local r, g, b, a = DarkMode:GetFrameColor() + local r, g, b, a = DarkMode:GetFrameColor(v) if r ~= nil and g ~= nil and b ~= nil then v:SetVertexColor(r, g, b, a) end @@ -1546,7 +1546,7 @@ function DarkMode:Event(event, ...) function(sel, name, ...) if sel.dm_settextcolor then return end sel.dm_settextcolor = true - local r, g, b, a = DarkMode:GetFrameColor() + local r, g, b, a = DarkMode:GetFrameColor(sel) local cr, cg, cb, ca = DarkMode:GetTextColor(r, g, b, a) sel:SetTextColor(name, cr, cg, cb, ca) sel.dm_settextcolor = false diff --git a/data.lua b/data.lua index ee4bf67..c59c049 100644 --- a/data.lua +++ b/data.lua @@ -48,44 +48,58 @@ function DarkMode:SetCustomColor(name, r, g, b, a) DarkMode:UpdateColors() end -function DarkMode:GetUiColor() +function DarkMode:GetBrighterColor(r, g, b, a, texture) + local name = D4:GetName(texture) + if name and DarkMode:IsBrighterFrame(name) then return D4:MClamp(r + 0.4, 0, 1), D4:MClamp(g + 0.4, 0, 1), D4:MClamp(b + 0.4, 0, 1), a end + + return r, g, b, a +end + +function DarkMode:GetUiColor(texture) local r, g, b, a = DarkMode:GetColor(DarkMode:GV("COLORMODE", 1), "CUSTOMUIC") + r, g, b, a = DarkMode:GetBrighterColor(r, g, b, a, texture) return r, g, b, a end -function DarkMode:GetUFColor() +function DarkMode:GetUFColor(texture) local r, g, b, a = DarkMode:GetColor(DarkMode:GV("COLORMODEUF", 1), "CUSTOMUFC") + r, g, b, a = DarkMode:GetBrighterColor(r, g, b, a, texture) return r, g, b, a end -function DarkMode:GetNPColor() +function DarkMode:GetNPColor(texture) local r, g, b, a = DarkMode:GetColor(DarkMode:GV("COLORMODENP", 1), "CUSTOMNPC") + r, g, b, a = DarkMode:GetBrighterColor(r, g, b, a, texture) return r, g, b, a end -function DarkMode:GetTTColor() +function DarkMode:GetTTColor(texture) local r, g, b, a = DarkMode:GetColor(DarkMode:GV("COLORMODETT", 1), "CUSTOMTTC") + r, g, b, a = DarkMode:GetBrighterColor(r, g, b, a, texture) return r, g, b, a end -function DarkMode:GetActionButtonsColor() +function DarkMode:GetActionButtonsColor(texture) local r, g, b, a = DarkMode:GetColor(DarkMode:GV("COLORMODEAB", 1), "CUSTOMABC") + r, g, b, a = DarkMode:GetBrighterColor(r, g, b, a, texture) return r, g, b, a end -function DarkMode:GetBuffsAndDebuffsColor() +function DarkMode:GetBuffsAndDebuffsColor(texture) local r, g, b, a = DarkMode:GetColor(DarkMode:GV("COLORMODEBAD", 1), "CUSTOMBADC") + r, g, b, a = DarkMode:GetBrighterColor(r, g, b, a, texture) return r, g, b, a end -function DarkMode:GetFrameColor() +function DarkMode:GetFrameColor(texture) local r, g, b, a = DarkMode:GetColor(DarkMode:GV("COLORMODEF", 1), "CUSTOMFRC") + r, g, b, a = DarkMode:GetBrighterColor(r, g, b, a, texture) return r, g, b, a end @@ -142,6 +156,19 @@ function DarkMode:GetUiAddonsTable() end local DMFrames = {"CharacterFrameInsetRight", "CharacterMainHandSlotFrame", "CharacterSecondaryHandSlotFrame", "CharacterRangedSlotFrame", "CharacterHandsSlotFrame", "CharacterWaistSlotFrame", "CharacterLegsSlotFrame", "CharacterFeetSlotFrame", "CharacterFinger0SlotFrame", "CharacterFinger1SlotFrame", "CharacterTrinket0SlotFrame", "CharacterTrinket1SlotFrame", "CharacterHeadSlotFrame", "CharacterNeckSlotFrame", "CharacterShoulderSlotFrame", "CharacterBackSlotFrame", "CharacterChestSlotFrame", "CharacterShirtSlotFrame", "CharacterTabardSlotFrame", "CharacterWristSlotFrame", "CharacterModelScene", "GroupLootHistoryFrame", "GroupLootHistoryFrame.ResizeButton", "ModelPreviewFrameCloseButton_LeftSeparator", "ModelPreviewFrame", "SideDressUpModelCloseButton", "SideDressUpFrame", "ArchaeologyFrame", "QuestLogDetailFrame", "QuestNPCModelTextFrame", "QuestModelScene", "MailItem1", "MailItem2", "MailItem3", "MailItem4", "MailItem5", "MailItem6", "MailItem7", "MailFrame", "InboxFrame", "GuildMemberDetailFrame", "TabardFrame", "TradeFrame", "TradeFrame.RecipientOverlay", "DressUpFrame", "LootFrame", "StaticPopup1", "StaticPopup2", "ItemTextFrame", "WorldStateScoreFrame", "WorldStateScoreFrameTab1", "WorldStateScoreFrameTab2", "WorldStateScoreFrameTab3", "SettingsPanel", "InspectPaperDollFrame", "PaperDollFrame", "CharacterFrame", "CharacterStatsPane", "CharacterFrameTab1", "CharacterFrameTab2", "CharacterFrameTab3", "CharacterFrameTab4", "CharacterFrameTab5", "nwtab5", "nwtab6", "ReputationFrame", "ReputationListScrollFrame", "SkillFrame", "SkillListScrollFrame", "SkillDetailScrollFrame", "HonorFrame", "PetPaperDollFrame", "PetPaperDollFrameTab1", "PetPaperDollFrameTab2", "PetPaperDollFrameTab3", "PetPaperDollFrameExpBar", "TokenFrame", "SpellBookFrame", "SpellBookSkillLineTab1", "SpellBookSkillLineTab2", "SpellBookSkillLineTab3", "SpellBookSkillLineTab4", "SpellBookSkillLineTab5", "SpellBookSkillLineTab6", "SpellBookSkillLineTab7", "WhatsTrainingFrame", "SpellBookFrameTabButton1", "SpellBookFrameTabButton2", "SpellBookFrameTabButton3", "SpellBookFrameTabButton4", "QuestLogFrame", "QuestLogCollapseAllButton", "QuestScrollFrame.ScrollBar", "FriendsFrame", "FriendsFrameFriendsScrollFrame", "FriendsFrameTab1", "FriendsFrameTab2", "FriendsFrameTab3", "FriendsFrameTab4", "FriendsFrameTab5", "WhoFrameList", "WorldMapFrame", "WorldMapFrame.BorderFrame", "WorldMapFrame.MiniBorderFrame", "LFGParentFrame", "LFGParentFrameTab1", "LFGParentFrameTab2", "LFMFrame", "LFGBrowseFrame", "LFGListingFrame", "PVEFrame", "PVEFrameTab1", "PVEFrameTab2", "PVEFrameTab3", "PVEFrameTab4", "PVPFrame", "PVPFrameTab1", "PVPFrameTab2", "PVPFrameTab3", "PVPFrameTab4", "ChallengesFrame", "GameMenuFrame", "GameMenuFrame.Border", "GameMenuFrame.Header", "QuestFrame", "QuestFrameDetailPanel", "QuestDetailScrollFrame", "QuestDetailScrollChildFrame", "GossipFrameGreetingPanel", "GossipGreetingScrollFrame", "QuestFrameGreetingPanel", "QuestGreetingScrollFrame", "QuestFrameProgressPanel", "QuestProgressScrollFrame", "QuestRewardScrollFrame", "QuestFrameRewardPanel", "QuestInfoRewardsFrame", "GossipFrame", "GossipFrame.GreetingPanel", "GossipFrame.GreetingPanel.ScrollBox", "GossipFrame.GreetingPanel.ScrollBar.Background", "MerchantFrame", "MerchantBuyBackItem", "MerchantFrameTab1", "MerchantFrameTab2", "MerchantItem1", "MerchantItem2", "MerchantItem3", "MerchantItem4", "MerchantItem5", "MerchantItem6", "MerchantItem7", "MerchantItem8", "MerchantItem9", "MerchantItem10", "MerchantItem11", "MerchantItem12", "MerchantMoney", "MerchantMoneyBg", "PetStableFrame", "AddonList", "AddonListDisableAllButton_RightSeparator", "AddonListEnableAllButton_RightSeparator", "AddonListOkayButton_LeftSeparator", "AddonListOkayButton_RightSeparator", "AddonListCancelButton_LeftSeparator", "HelpFrame", "VideoOptionsFrame", "InterfaceOptionsFrame", "TimeManagerFrame", "OpenMailFrame", "OpenMailScrollFrame", "MailFrameTab1", "MailFrameTab2", "SendMailFrame", "SendMailMoney", "SendMailMoneyBg", "SendMailMoneyFrame", "SendMail", "MailEditBoxScrollBar", "BankFrame", "BankFrameTab1", "BankFrameTab2", "BankFrameMoneyFrame", "BankFrameMoneyFrameBorder", "BackpackTokenFrame", "ContainerFrame1", "ContainerFrame2", "ContainerFrame3", "ContainerFrame4", "ContainerFrame5", "ContainerFrame6", "ContainerFrame7", "ContainerFrame8", "ContainerFrame9", "ContainerFrame10", "ContainerFrame11", "ContainerFrame12", "ContainerFrameCombinedBags", "PVPFrame", "PVPParentFrame", "PVPParentFrameTab1", "PVPParentFrameTab2", "BattlefieldFrame", "BattlefieldListScrollFrame", "BattlefieldFrameType", "TaxiFrame", "YourFrameName", "QuestMapFrame", "QuestMapFrame.DetailsFrame"} +local DMFranesBrighter = {} +for x = 1, 12 do + for i = 1, 32 do + local name = string.format("ContainerFrame%sItem%sNormalTexture", x, i) + tinsert(DMFrames, name) + DMFranesBrighter[name] = true + end +end + +function DarkMode:IsBrighterFrame(name) + return DMFranesBrighter[name] or false +end + function DarkMode:GetFrameTable() return DMFrames end diff --git a/libs/D4Lib/D4Lib.lua b/libs/D4Lib/D4Lib.lua index e12598c..f77d08c 100644 --- a/libs/D4Lib/D4Lib.lua +++ b/libs/D4Lib/D4Lib.lua @@ -129,6 +129,12 @@ function D4:IsAddOnLoaded(name) return nil end +function D4:GetName(frameOrTexture) + if frameOrTexture and frameOrTexture.GetName then return frameOrTexture:GetName() end + + return nil +end + local function FixIconChat(self, event, message, author, ...) if ICON_LIST then for tag in string.gmatch(message, "%b{}") do diff --git a/libs/D4Lib/D4Lib.xml b/libs/D4Lib/D4Lib.xml index b91e41d..3d61c99 100644 --- a/libs/D4Lib/D4Lib.xml +++ b/libs/D4Lib/D4Lib.xml @@ -6,6 +6,8 @@