Skip to content

Commit

Permalink
v0.5.50
Browse files Browse the repository at this point in the history
  • Loading branch information
d4kir92 committed Jun 19, 2024
1 parent 17fe28a commit 19f5ffd
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 41 deletions.
2 changes: 1 addition & 1 deletion DarkMode.toc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion DarkMode_Cata.toc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion DarkMode_TBC.toc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion DarkMode_Vanilla.toc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion DarkMode_Wrath.toc
Original file line number Diff line number Diff line change
@@ -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
Expand Down
54 changes: 27 additions & 27 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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()
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -360,36 +360,36 @@ 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
end

-- 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
Expand Down Expand Up @@ -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
Expand Down
41 changes: 34 additions & 7 deletions data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions libs/D4Lib/D4Lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions libs/D4Lib/D4Lib.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

<Script file="D4Lib.lua"/>

<Script file="D4Math.lua"/>

<Script file="D4Output.lua"/>
<Script file="D4DB.lua"/>

Expand Down
11 changes: 11 additions & 0 deletions libs/D4Lib/D4Math.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
local _, _ = ...
D4 = D4 or {}
function D4:MClamp(val, vmin, vmax)
if val < vmin then
return vmin
elseif val > vmax then
return vmax
end

return val
end
4 changes: 2 additions & 2 deletions settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ function DarkMode:InitDMSettings()
DMSettings:Hide()
end

D4:SetVersion(AddonName, 136122, "0.5.49")
DMSettings.TitleText:SetText(format("DarkMode |T136122:16:16:0:0|t v|cff3FC7EB%s", "0.5.49"))
D4:SetVersion(AddonName, 136122, "0.5.50")
DMSettings.TitleText:SetText(format("DarkMode |T136122:16:16:0:0|t v|cff3FC7EB%s", "0.5.50"))
DMSettings.CloseButton:SetScript(
"OnClick",
function()
Expand Down

0 comments on commit 19f5ffd

Please sign in to comment.