fix: quality item colors

This commit is contained in:
Vati
2026-02-27 04:24:49 +04:00
parent 8e73db855d
commit 9712e907d2
2 changed files with 43 additions and 13 deletions
+14
View File
@@ -491,6 +491,20 @@ function Utils:GetQualityColor(quality)
return color.r, color.g, color.b
end
-- Extract RGB color from an item link's |cffRRGGBB prefix (the title color)
-- Returns r, g, b (0-1 floats) or nil if no color found
function Utils:GetLinkColor(itemLink)
if not itemLink then return nil end
-- Lua 5.0: use string.find with captures instead of string.match
local _, _, hex = string.find(itemLink, "|c(%x%x%x%x%x%x%x%x)")
if not hex then return nil end
-- hex is AARRGGBB
local r = tonumber(string.sub(hex, 3, 4), 16) / 255
local g = tonumber(string.sub(hex, 5, 6), 16) / 255
local b = tonumber(string.sub(hex, 7, 8), 16) / 255
return r, g, b
end
-- Create colored text
function Utils:ColorText(text, r, g, b)
local red = math.floor(r * 255)