From ee20f823f749699b589b75b446cab9831406ebcd Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 27 Mar 2026 10:14:47 -0700 Subject: [PATCH] refactor: replace 8 more inline color literals with existing constants Replace kYellow (5), kRed (2), kGray (1), kLightGray (1) inline ImVec4 literals in realm_screen, spellbook_screen, talent_screen, game_screen, and inventory_screen. --- src/ui/game_screen.cpp | 2 +- src/ui/inventory_screen.cpp | 4 ++-- src/ui/realm_screen.cpp | 2 +- src/ui/spellbook_screen.cpp | 4 ++-- src/ui/talent_screen.cpp | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index ef36f934..a9fdc8a9 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -5254,7 +5254,7 @@ void GameScreen::renderFocusFrame(game::GameHandler& gameHandler) { int fRank = gameHandler.getCreatureRank(focusUnit->getEntry()); if (fRank == 1) { ImGui::SameLine(0,4); ImGui::TextColored(ImVec4(1.0f,0.8f,0.2f,1.0f), "[Elite]"); } else if (fRank == 2) { ImGui::SameLine(0,4); ImGui::TextColored(ImVec4(0.8f,0.4f,1.0f,1.0f), "[Rare Elite]"); } - else if (fRank == 3) { ImGui::SameLine(0,4); ImGui::TextColored(ImVec4(1.0f,0.3f,0.3f,1.0f), "[Boss]"); } + else if (fRank == 3) { ImGui::SameLine(0,4); ImGui::TextColored(colors::kRed, "[Boss]"); } else if (fRank == 4) { ImGui::SameLine(0,4); ImGui::TextColored(ImVec4(0.5f,0.9f,1.0f,1.0f), "[Rare]"); } // Creature type diff --git a/src/ui/inventory_screen.cpp b/src/ui/inventory_screen.cpp index 23c8f416..e0253641 100644 --- a/src/ui/inventory_screen.cpp +++ b/src/ui/inventory_screen.cpp @@ -3666,8 +3666,8 @@ void InventoryScreen::renderItemTooltip(const game::ItemQueryResponseData& info, float diff = nv - ev; char buf[96]; if (diff > 0.0f) { std::snprintf(buf, sizeof(buf), "%s: %.0f (▲%.0f)", label, nv, diff); ImGui::TextColored(ImVec4(0.0f,1.0f,0.0f,1.0f), "%s", buf); } - else if (diff < 0.0f) { std::snprintf(buf, sizeof(buf), "%s: %.0f (▼%.0f)", label, nv, -diff); ImGui::TextColored(ImVec4(1.0f,0.3f,0.3f,1.0f), "%s", buf); } - else { std::snprintf(buf, sizeof(buf), "%s: %.0f (=)", label, nv); ImGui::TextColored(ImVec4(0.7f,0.7f,0.7f,1.0f), "%s", buf); } + else if (diff < 0.0f) { std::snprintf(buf, sizeof(buf), "%s: %.0f (▼%.0f)", label, nv, -diff); ImGui::TextColored(ui::colors::kRed, "%s", buf); } + else { std::snprintf(buf, sizeof(buf), "%s: %.0f (=)", label, nv); ImGui::TextColored(ui::colors::kLightGray, "%s", buf); } }; float ilvlDiff = static_cast(info.itemLevel) - static_cast(eq->item.itemLevel); diff --git a/src/ui/realm_screen.cpp b/src/ui/realm_screen.cpp index d2f8eecf..4df8a80f 100644 --- a/src/ui/realm_screen.cpp +++ b/src/ui/realm_screen.cpp @@ -240,7 +240,7 @@ ImVec4 RealmScreen::getPopulationColor(float population) const { if (population < 0.5f) { return ui::colors::kBrightGreen; // Green - Low } else if (population < 1.5f) { - return ImVec4(1.0f, 1.0f, 0.3f, 1.0f); // Yellow - Medium + return ui::colors::kYellow; // Yellow - Medium } else if (population < 2.5f) { return ImVec4(1.0f, 0.6f, 0.0f, 1.0f); // Orange - High } else { diff --git a/src/ui/spellbook_screen.cpp b/src/ui/spellbook_screen.cpp index e418c449..93ad5061 100644 --- a/src/ui/spellbook_screen.cpp +++ b/src/ui/spellbook_screen.cpp @@ -485,12 +485,12 @@ void SpellbookScreen::renderSpellTooltip(const SpellInfo* info, game::GameHandle ImGui::PushTextWrapPos(320.0f); // Spell name in yellow - ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.3f, 1.0f), "%s", info->name.c_str()); + ImGui::TextColored(ui::colors::kYellow, "%s", info->name.c_str()); // Rank in gray if (!info->rank.empty()) { ImGui::SameLine(); - ImGui::TextColored(ImVec4(0.6f, 0.6f, 0.6f, 1.0f), "(%s)", info->rank.c_str()); + ImGui::TextColored(ui::colors::kGray, "(%s)", info->rank.c_str()); } // Passive indicator diff --git a/src/ui/talent_screen.cpp b/src/ui/talent_screen.cpp index c6748e0c..99e743f4 100644 --- a/src/ui/talent_screen.cpp +++ b/src/ui/talent_screen.cpp @@ -185,7 +185,7 @@ void TalentScreen::renderTalentTrees(game::GameHandler& gameHandler) { } if (ImGui::BeginPopupModal("Learn Talent?##talent_confirm", nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove)) { - ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.3f, 1.0f), "%s", pendingTalentName_.c_str()); + ImGui::TextColored(ui::colors::kYellow, "%s", pendingTalentName_.c_str()); ImGui::Text("Rank %u", pendingTalentRank_ + 1); ImGui::Spacing(); ImGui::TextWrapped("Spend a talent point?"); @@ -524,9 +524,9 @@ void TalentScreen::renderTalent(game::GameHandler& gameHandler, // Spell name const std::string& spellName = gameHandler.getSpellName(spellId); if (!spellName.empty()) { - ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.3f, 1.0f), "%s", spellName.c_str()); + ImGui::TextColored(ui::colors::kYellow, "%s", spellName.c_str()); } else { - ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.3f, 1.0f), "Talent #%u", talent.talentId); + ImGui::TextColored(ui::colors::kYellow, "Talent #%u", talent.talentId); } // Rank display