Skip to content

Commit

Permalink
finish part of custom class colors
Browse files Browse the repository at this point in the history
  • Loading branch information
kodewdle committed Dec 7, 2024
1 parent 157ddef commit e785e55
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions ElvUI/Core/General/API.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ local LCS = E.Libs.LCS
local ElvUF = E.oUF

local _G = _G
local setmetatable = setmetatable
local hooksecurefunc = hooksecurefunc
local type, ipairs, pairs, unpack = type, ipairs, pairs, unpack
local wipe, max, next, tinsert, date, time = wipe, max, next, tinsert, date, time
local strfind, strlen, tonumber, tostring = strfind, strlen, tonumber, tostring
local hooksecurefunc = hooksecurefunc

local CopyTable = CopyTable
local CreateFrame = CreateFrame
Expand Down Expand Up @@ -469,10 +470,23 @@ do
callbacks[func] = nil
end

function E:CustomClassColorNotify()
local changed = E:UpdateCustomClassColors()
if changed then
E:CustomClassColorUpdate()
end
end

function E:CustomClassColorClassToken(className)
return E:UnlocalizedClassName(className)
end

local meta = {
__index = {
RegisterCallback = E.CustomClassColorRegister,
UnregisterCallback = E.CustomClassColorUnregister
UnregisterCallback = E.CustomClassColorUnregister,
NotifyChanges = E.CustomClassColorNotify,
GetClassToken = E.CustomClassColorClassToken
}
}

Expand Down Expand Up @@ -504,17 +518,23 @@ do
if not E.private.general.classColors then return end

local custom = _G.CUSTOM_CLASS_COLORS or E:SetupCustomClassColors()
local colors = E.db.general.classColors
local colors, changed = E.db.general.classColors

for classTag, db in next, colors do
local color = custom[classTag]
if color then
E:UpdateClassColor(db)

color.r, color.g, color.b = db.r, db.g, db.b
color.colorStr = E:RGBToHex(db.r, db.g, db.b, 'ff')
if color.r ~= db.r or color.g ~= db.g or color.b ~= db.b then
color.r, color.g, color.b = db.r, db.g, db.b
color.colorStr = E:RGBToHex(db.r, db.g, db.b, 'ff')

changed = true
end
end
end

return changed
end
end

Expand Down

0 comments on commit e785e55

Please sign in to comment.