From 182127bd67a285fec19fd9774771319b11cb8182 Mon Sep 17 00:00:00 2001 From: Brues <5278969+brues-code@users.noreply.github.com> Date: Fri, 24 Jul 2026 15:00:16 -0500 Subject: [PATCH] Refactor totems to use CreateColor API Replace manual color tables with CreateColor() function calls for better code consistency and API usage. Update tooltip color handling to use WHITE_FONT_COLOR:GetRGB() instead of hardcoded hex color codes. Rename 'slots' variable to 'slotColors' for clarity. --- modules/totems.lua | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/totems.lua b/modules/totems.lua index fc107c76..e536b797 100644 --- a/modules/totems.lua +++ b/modules/totems.lua @@ -1,9 +1,9 @@ pfUI:RegisterModule("totems", function () - local slots = { - [FIRE_TOTEM_SLOT] = { r = .5, g = .2, b = .1 }, - [EARTH_TOTEM_SLOT] = { r = .2, g = .4, b = .1 }, - [WATER_TOTEM_SLOT] = { r = .1, g = .4, b = .6 }, - [AIR_TOTEM_SLOT] = { r = .4, g = .1, b = .7 }, + local slotColors = { + [FIRE_TOTEM_SLOT] = CreateColor(.5, .2, .1), + [EARTH_TOTEM_SLOT] = CreateColor(.2, .4, .1), + [WATER_TOTEM_SLOT] = CreateColor(.1, .4, .6), + [AIR_TOTEM_SLOT] = CreateColor(.4, .1, .7), } local totems = CreateFrame("Frame", "pfTotems", UIParent) @@ -19,8 +19,8 @@ pfUI:RegisterModule("totems", function () if not spellID or spellID == 0 then return end GameTooltip:SetOwner(this, "ANCHOR_LEFT") GameTooltip:SetSpellByID(spellID) - GameTooltip:AddDoubleLine(T["Left Click"], "|cffffffff" .. T["Recast Totem"]) - GameTooltip:AddDoubleLine(T["Right Click"], "|cffffffff" .. T["Target Totem"]) + GameTooltip:AddDoubleLine(T["Left Click"], T["Recast Totem"], nil, nil, nil, WHITE_FONT_COLOR:GetRGB()) + GameTooltip:AddDoubleLine(T["Right Click"], T["Target Totem"], nil, nil, nil, WHITE_FONT_COLOR:GetRGB()) GameTooltip:Show() end @@ -43,10 +43,9 @@ pfUI:RegisterModule("totems", function () if start and start > 0 and icon and icon ~= "" then count = count + 1 - local color = slots[i] self.bar[count]:Show() - self.bar[count]:SetBackdropBorderColor(color.r, color.g, color.b) + self.bar[count]:SetBackdropBorderColor(slotColors[i]:GetRGB()) self.bar[count].icon:SetTexture(icon) self.bar[count]:SetID(i)