Skip to content

Commit

Permalink
v0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
d4kir92 committed Dec 13, 2023
1 parent 2db695b commit c775c73
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 82 deletions.
2 changes: 1 addition & 1 deletion DarkMode.toc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Interface-Wrath: 30403
## Interface: 100200

## Version: 0.3.41
## Version: 0.4.0
## 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_TBC.toc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Interface: 20504
## Version: 0.3.41
## Version: 0.4.0
## 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: 11500
## Version: 0.3.41
## Version: 0.4.0
## 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.3.41
## Version: 0.4.0
## 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
186 changes: 118 additions & 68 deletions core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ local DMTexturesUi = {}
local DMTexturesUF = {}
local DMTexturesTT = {}
local DMTexturesFrames = {}
local DMTexturesActionButtons = {}
local DMTexturesBuffsAndDebuffs = {}
function DarkMode:UpdateColor(texture, typ)
if not DarkMode:IsValidTexture(texture) then return false end
if texture == nil then
Expand Down Expand Up @@ -88,6 +90,24 @@ function DarkMode:UpdateColor(texture, typ)
a = texture:GetAlpha()
end

texture:SetColorTexture(r, g, b, a)
end
elseif typ == "actionbuttons" then
local r, g, b, a = DarkMode:GetActionButtonsColor()
if r ~= nil and g ~= nil and b ~= nil then
if texture:GetAlpha() < 1 then
a = texture:GetAlpha()
end

texture:SetColorTexture(r, g, b, a)
end
elseif typ == "buffsanddebuffs" then
local r, g, b, a = DarkMode:GetBuffsAndDebuffsColor()
if r ~= nil and g ~= nil and b ~= nil then
if texture:GetAlpha() < 1 then
a = texture:GetAlpha()
end

texture:SetColorTexture(r, g, b, a)
end
else
Expand Down Expand Up @@ -127,6 +147,16 @@ function DarkMode:UpdateColor(texture, typ)
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()
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()
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()
if r ~= nil and g ~= nil and b ~= nil then
Expand Down Expand Up @@ -154,6 +184,16 @@ function DarkMode:UpdateColor(texture, typ)
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()
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()
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()
if r ~= nil and g ~= nil and b ~= nil then
Expand All @@ -173,6 +213,14 @@ function DarkMode:UpdateColor(texture, typ)
if not tContains(DMTexturesTT, texture) then
tinsert(DMTexturesTT, texture)
end
elseif typ == "actionbuttons" then
if not tContains(DMTexturesActionButtons, texture) then
tinsert(DMTexturesActionButtons, texture)
end
elseif typ == "buffsanddebuffs" then
if not tContains(DMTexturesBuffsAndDebuffs, texture) then
tinsert(DMTexturesBuffsAndDebuffs, texture)
end
else
if not tContains(DMTexturesFrames, texture) then
tinsert(DMTexturesFrames, texture)
Expand Down Expand Up @@ -612,24 +660,24 @@ function DarkMode:SearchUi()
border:SetSize(sw * scale, sh * scale)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\default")
border:SetPoint("CENTER", _G[name .. x], "CENTER", 0, 0)
DarkMode:UpdateColor(border, "ui")
DarkMode:UpdateColor(border, "actionbuttons")
elseif btnTexture then
DarkMode:UpdateColor(btnTexture, "ui")
DarkMode:UpdateColor(btnTexture, "actionbuttons")
end

local btnTexture2 = _G[name .. x .. "FloatingBG"]
if btnTexture2 then
DarkMode:UpdateColor(btnTexture2, "ui")
DarkMode:UpdateColor(btnTexture2, "actionbuttons")
end

if _G[name .. x] and _G[name .. x]["SlotBackground"] then
DarkMode:UpdateColor(_G[name .. x]["SlotBackground"], "ui")
DarkMode:UpdateColor(_G[name .. x]["SlotBackground"], "actionbuttons")
end

if _G[name .. x] and _G[name .. x]["RightDivider"] then
DarkMode:UpdateColor(_G[name .. x]["RightDivider"]["TopEdge"], "ui")
DarkMode:UpdateColor(_G[name .. x]["RightDivider"]["Center"], "ui")
DarkMode:UpdateColor(_G[name .. x]["RightDivider"]["BottomEdge"], "ui")
DarkMode:UpdateColor(_G[name .. x]["RightDivider"]["TopEdge"], "actionbuttons")
DarkMode:UpdateColor(_G[name .. x]["RightDivider"]["Center"], "actionbuttons")
DarkMode:UpdateColor(_G[name .. x]["RightDivider"]["BottomEdge"], "actionbuttons")
end

if DarkMode:GetWoWBuild() ~= "RETAIL" and DarkMode:IsEnabled("MASKACTIONBUTTONS", true) then
Expand All @@ -650,7 +698,7 @@ function DarkMode:SearchUi()
border:SetSize(sw * scale, sh * scale)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\defaultEER")
border:SetPoint("CENTER", _G[name .. x], "CENTER", 0, 0)
DarkMode:UpdateColor(border, "ui")
DarkMode:UpdateColor(border, "actionbuttons")
end
end
end
Expand Down Expand Up @@ -939,73 +987,75 @@ function DarkMode:Event(event, ...)
)
end

if AuraFrameMixin and AuraFrameMixin.Update then
hooksecurefunc(
AuraFrameMixin,
"Update",
function(sel)
for index, bf in pairs(sel.auraFrames) do
if bf and _G["Buff" .. index .. "BorderDM"] == nil then
local _, sh = bf.Icon:GetSize()
sh = DarkMode:MathR(sh)
local scale = 1
_G["Buff" .. index .. "BorderDM"] = bf:CreateTexture("Buff" .. index .. "BorderDM", "OVERLAY")
local border = _G["Buff" .. index .. "BorderDM"]
border:SetDrawLayer("OVERLAY", 3)
border:SetSize(sh * scale, sh * scale)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\default")
border:SetPoint("CENTER", bf.Icon, "CENTER", 0, 0)
DarkMode:UpdateColor(border, "ui")
if DarkMode:IsEnabled("MASKBUFFSANDEBUFFS", true) then
if AuraFrameMixin and AuraFrameMixin.Update then
hooksecurefunc(
AuraFrameMixin,
"Update",
function(sel)
for index, bf in pairs(sel.auraFrames) do
if bf and _G["Buff" .. index .. "BorderDM"] == nil then
local _, sh = bf.Icon:GetSize()
sh = DarkMode:MathR(sh)
local scale = 1
_G["Buff" .. index .. "BorderDM"] = bf:CreateTexture("Buff" .. index .. "BorderDM", "OVERLAY")
local border = _G["Buff" .. index .. "BorderDM"]
border:SetDrawLayer("OVERLAY", 3)
border:SetSize(sh * scale, sh * scale)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\default")
border:SetPoint("CENTER", bf.Icon, "CENTER", 0, 0)
DarkMode:UpdateColor(border, "buffsanddebuffs")
end
end
end
end
)
elseif BuffFrame_UpdateAllBuffAnchors then
hooksecurefunc(
"BuffFrame_UpdateAllBuffAnchors",
function()
local buttonName = "BuffButton"
for index = 1, BUFF_ACTUAL_DISPLAY do
if _G[buttonName .. index] and _G[buttonName .. index .. "BorderDM"] == nil then
local sw, sh = _G[buttonName .. index]:GetSize()
sw = DarkMode:MathR(sw)
sh = DarkMode:MathR(sh)
local scale = 1.1
_G[buttonName .. index .. "BorderDM"] = _G[buttonName .. index]:CreateTexture(buttonName .. index .. "BorderDM", "OVERLAY")
local border = _G[buttonName .. index .. "BorderDM"]
border:SetDrawLayer("OVERLAY", 3)
border:SetSize(sw * scale, sh * scale)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\default")
border:SetPoint("CENTER", _G[buttonName .. index], "CENTER", 0, 0)
DarkMode:UpdateColor(border, "ui")
)
elseif BuffFrame_UpdateAllBuffAnchors then
hooksecurefunc(
"BuffFrame_UpdateAllBuffAnchors",
function()
local buttonName = "BuffButton"
for index = 1, BUFF_ACTUAL_DISPLAY do
if _G[buttonName .. index] and _G[buttonName .. index .. "BorderDM"] == nil then
local sw, sh = _G[buttonName .. index]:GetSize()
sw = DarkMode:MathR(sw)
sh = DarkMode:MathR(sh)
local scale = 1.1
_G[buttonName .. index .. "BorderDM"] = _G[buttonName .. index]:CreateTexture(buttonName .. index .. "BorderDM", "OVERLAY")
local border = _G[buttonName .. index .. "BorderDM"]
border:SetDrawLayer("OVERLAY", 3)
border:SetSize(sw * scale, sh * scale)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\default")
border:SetPoint("CENTER", _G[buttonName .. index], "CENTER", 0, 0)
DarkMode:UpdateColor(border, "buffsanddebuffs")
end
end
end
end
)
end
)
end

if TargetFrame_UpdateAuras then
hooksecurefunc(
"TargetFrame_UpdateAuras",
function(frame)
local buttonName = frame:GetName() .. "Buff"
for index = 1, BUFF_ACTUAL_DISPLAY do
if _G[buttonName .. index] and _G[buttonName .. index .. "BorderDM"] == nil then
local sw, sh = _G[buttonName .. index]:GetSize()
sw = DarkMode:MathR(sw)
sh = DarkMode:MathR(sh)
local scale = 1.1
_G[buttonName .. index .. "BorderDM"] = _G[buttonName .. index]:CreateTexture(buttonName .. index .. "BorderDM", "OVERLAY")
local border = _G[buttonName .. index .. "BorderDM"]
border:SetDrawLayer("OVERLAY", 3)
border:SetSize(sw * scale, sh * scale)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\default")
border:SetPoint("CENTER", _G[buttonName .. index], "CENTER", 0, 0)
DarkMode:UpdateColor(border, "ui")
if TargetFrame_UpdateAuras then
hooksecurefunc(
"TargetFrame_UpdateAuras",
function(frame)
local buttonName = frame:GetName() .. "Buff"
for index = 1, BUFF_ACTUAL_DISPLAY do
if _G[buttonName .. index] and _G[buttonName .. index .. "BorderDM"] == nil then
local sw, sh = _G[buttonName .. index]:GetSize()
sw = DarkMode:MathR(sw)
sh = DarkMode:MathR(sh)
local scale = 1.1
_G[buttonName .. index .. "BorderDM"] = _G[buttonName .. index]:CreateTexture(buttonName .. index .. "BorderDM", "OVERLAY")
local border = _G[buttonName .. index .. "BorderDM"]
border:SetDrawLayer("OVERLAY", 3)
border:SetSize(sw * scale, sh * scale)
border:SetTexture("Interface\\AddOns\\DarkMode\\media\\default")
border:SetPoint("CENTER", _G[buttonName .. index], "CENTER", 0, 0)
DarkMode:UpdateColor(border, "buffsanddebuffs")
end
end
end
end
)
)
end
end

C_Timer.After(
Expand Down
12 changes: 12 additions & 0 deletions data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ function DarkMode:GetTTColor()
return r, g, b, a
end

function DarkMode:GetActionButtonsColor()
local r, g, b, a = DarkMode:GetColor(DarkMode:GV("COLORMODEAB", 1), "CUSTOMABC")

return r, g, b, a
end

function DarkMode:GetBuffsAndDebuffsColor()
local r, g, b, a = DarkMode:GetColor(DarkMode:GV("COLORMODEBAD", 1), "CUSTOMBADC")

return r, g, b, a
end

function DarkMode:GetFrameColor()
local r, g, b, a = DarkMode:GetColor(DarkMode:GV("COLORMODEF", 1), "CUSTOMFRC")

Expand Down
6 changes: 5 additions & 1 deletion locale/deDE.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
-- deDE German Deutsch
local _, DarkMode = ...

function DarkMode:Lang_deDE()
local tab = {
["MMBTNLEFT"] = "Linksklick => Optionen",
Expand All @@ -10,13 +9,18 @@ function DarkMode:Lang_deDE()
["COLORMODE"] = "Farbmodus Ui",
["COLORMODEUF"] = "Farbmodus Einheitenfenster",
["COLORMODETT"] = "Farbmodus Tooltips",
["COLORMODEAB"] = "Farbmodus Aktionsknöpfe",
["COLORMODEBAD"] = "Farbmodus Buffs und Debuffs",
["COLORMODEF"] = "Farbmodus Fenster",
["CUSTOMUIC"] = "Benutzerdefinierte Ui Farbe",
["CUSTOMUFC"] = "Benutzerdefinierte Einheitenfenster Farbe",
["CUSTOMTTC"] = "Benutzerdefinierte Tooltip Farbe",
["CUSTOMABC"] = "Benutzerdefinierte Aktionsknöpfe Farbe",
["CUSTOMBADC"] = "Benutzerdefinierte Buffs und Debuffs Farbe",
["CUSTOMFRC"] = "Benutzerdefinierte Fenster Farbe",
["MASKACTIONBUTTONS"] = "Aktionsknöpfe maskieren",
["GRYPHONS"] = "Greifen maskieren",
["MASKBUFFSANDDEBUFFS"] = "Buffs und Debuffs maskieren",
}

DarkMode:UpdateLanguageTab(tab)
Expand Down
7 changes: 5 additions & 2 deletions locale/enUS.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
-- enUS English
local _, DarkMode = ...

function DarkMode:UpdateLanguageTab(tab)
local lang = DarkMode:GetLangTab()

for i, v in pairs(tab) do
lang[i] = v
end
Expand All @@ -18,13 +16,18 @@ function DarkMode:Lang_enUS()
["COLORMODE"] = "Color Mode Ui",
["COLORMODEUF"] = "Color Mode UnitFrames",
["COLORMODETT"] = "Color Mode Tooltips",
["COLORMODEAB"] = "Color Mode Actionbuttons",
["COLORMODEBAD"] = "Color Mode Buffs and Debuffs",
["COLORMODEF"] = "Color Mode Windows",
["CUSTOMUIC"] = "Custom Ui Color",
["CUSTOMUFC"] = "Custom UnitFrames Color",
["CUSTOMTTC"] = "Custom Tooltip Color",
["CUSTOMABC"] = "Custom Actionbuttons Color",
["CUSTOMBADC"] = "Custom Buffs and Debuffs Color",
["CUSTOMFRC"] = "Custom Windows Color",
["MASKACTIONBUTTONS"] = "Mask Actionbuttons",
["GRYPHONS"] = "Mask Gryphons",
["MASKBUFFSANDDEBUFFS"] = "Mask Buffs and Debuffs",
}

DarkMode:UpdateLanguageTab(tab)
Expand Down
Loading

0 comments on commit c775c73

Please sign in to comment.