refactor: replace 60+ inline color literals with shared ui::colors constants

Use kRed, kBrightGreen, kDarkGray, kLightGray from ui_colors.hpp across
8 UI files, eliminating duplicate ImVec4 color definitions throughout
the UI layer.
This commit is contained in:
Kelsi 2026-03-25 12:29:44 -07:00
parent 4d46641ac2
commit b892dca0e5
8 changed files with 58 additions and 52 deletions

View file

@ -1,4 +1,5 @@
#include "ui/auth_screen.hpp" #include "ui/auth_screen.hpp"
#include "ui/ui_colors.hpp"
#include "auth/crypto.hpp" #include "auth/crypto.hpp"
#include "core/application.hpp" #include "core/application.hpp"
#include "core/logger.hpp" #include "core/logger.hpp"
@ -393,9 +394,9 @@ void AuthScreen::render(auth::AuthHandler& authHandler) {
// Connection status // Connection status
if (!statusMessage.empty()) { if (!statusMessage.empty()) {
if (statusIsError) { if (statusIsError) {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.3f, 0.3f, 1.0f)); ImGui::PushStyleColor(ImGuiCol_Text, ui::colors::kRed);
} else { } else {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.3f, 1.0f, 0.3f, 1.0f)); ImGui::PushStyleColor(ImGuiCol_Text, ui::colors::kBrightGreen);
} }
ImGui::TextWrapped("%s", statusMessage.c_str()); ImGui::TextWrapped("%s", statusMessage.c_str());
ImGui::PopStyleColor(); ImGui::PopStyleColor();

View file

@ -1,4 +1,5 @@
#include "ui/character_create_screen.hpp" #include "ui/character_create_screen.hpp"
#include "ui/ui_colors.hpp"
#include "rendering/character_preview.hpp" #include "rendering/character_preview.hpp"
#include "rendering/renderer.hpp" #include "rendering/renderer.hpp"
#include "core/application.hpp" #include "core/application.hpp"
@ -382,7 +383,7 @@ void CharacterCreateScreen::render(game::GameHandler& /*gameHandler*/) {
preview_->rotate(deltaX * 0.2f); preview_->rotate(deltaX * 0.2f);
} }
ImGui::TextColored(ImVec4(0.5f, 0.5f, 0.5f, 1.0f), "Drag to rotate"); ImGui::TextColored(ui::colors::kDarkGray, "Drag to rotate");
} }
ImGui::EndChild(); ImGui::EndChild();
@ -424,7 +425,7 @@ void CharacterCreateScreen::render(game::GameHandler& /*gameHandler*/) {
} }
} }
if (allianceRaceCount_ < raceCount) { if (allianceRaceCount_ < raceCount) {
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), "Horde:"); ImGui::TextColored(ui::colors::kRed, "Horde:");
ImGui::SameLine(); ImGui::SameLine();
for (int i = allianceRaceCount_; i < raceCount; ++i) { for (int i = allianceRaceCount_; i < raceCount; ++i) {
if (i > allianceRaceCount_) ImGui::SameLine(); if (i > allianceRaceCount_) ImGui::SameLine();
@ -517,7 +518,7 @@ void CharacterCreateScreen::render(game::GameHandler& /*gameHandler*/) {
if (!statusMessage.empty()) { if (!statusMessage.empty()) {
ImGui::Separator(); ImGui::Separator();
ImGui::Spacing(); ImGui::Spacing();
ImVec4 color = statusIsError ? ImVec4(1.0f, 0.3f, 0.3f, 1.0f) : ImVec4(0.3f, 1.0f, 0.3f, 1.0f); ImVec4 color = statusIsError ? ui::colors::kRed : ui::colors::kBrightGreen;
ImGui::TextColored(color, "%s", statusMessage.c_str()); ImGui::TextColored(color, "%s", statusMessage.c_str());
} }

View file

@ -1,4 +1,5 @@
#include "ui/character_screen.hpp" #include "ui/character_screen.hpp"
#include "ui/ui_colors.hpp"
#include "rendering/character_preview.hpp" #include "rendering/character_preview.hpp"
#include "rendering/renderer.hpp" #include "rendering/renderer.hpp"
#include "pipeline/asset_manager.hpp" #include "pipeline/asset_manager.hpp"
@ -173,7 +174,7 @@ void CharacterScreen::render(game::GameHandler& gameHandler) {
// Status message // Status message
if (!statusMessage.empty()) { if (!statusMessage.empty()) {
ImVec4 color = statusIsError ? ImVec4(1.0f, 0.3f, 0.3f, 1.0f) : ImVec4(0.3f, 1.0f, 0.3f, 1.0f); ImVec4 color = statusIsError ? ui::colors::kRed : ui::colors::kBrightGreen;
ImGui::PushStyleColor(ImGuiCol_Text, color); ImGui::PushStyleColor(ImGuiCol_Text, color);
ImGui::TextWrapped("%s", statusMessage.c_str()); ImGui::TextWrapped("%s", statusMessage.c_str());
ImGui::PopStyleColor(); ImGui::PopStyleColor();
@ -462,7 +463,7 @@ void CharacterScreen::render(game::GameHandler& gameHandler) {
if (ImGui::BeginPopupModal("DeleteConfirm2", nullptr, if (ImGui::BeginPopupModal("DeleteConfirm2", nullptr,
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove)) { ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove)) {
const auto& ch = characters[selectedCharacterIndex]; const auto& ch = characters[selectedCharacterIndex];
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.3f, 0.3f, 1.0f)); ImGui::PushStyleColor(ImGuiCol_Text, ui::colors::kRed);
ImGui::Text("THIS CANNOT BE UNDONE!"); ImGui::Text("THIS CANNOT BE UNDONE!");
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::Spacing(); ImGui::Spacing();
@ -518,7 +519,7 @@ ImVec4 CharacterScreen::getFactionColor(game::Race race) const {
race == game::Race::TAUREN || race == game::Race::TAUREN ||
race == game::Race::TROLL || race == game::Race::TROLL ||
race == game::Race::BLOOD_ELF) { race == game::Race::BLOOD_ELF) {
return ImVec4(1.0f, 0.3f, 0.3f, 1.0f); return ui::colors::kRed;
} }
return ImVec4(1.0f, 1.0f, 1.0f, 1.0f); return ImVec4(1.0f, 1.0f, 1.0f, 1.0f);

View file

@ -1460,9 +1460,9 @@ void GameScreen::renderChatWindow(game::GameHandler& gameHandler) {
} }
if (slotName[0]) { if (slotName[0]) {
if (!info->subclassName.empty()) if (!info->subclassName.empty())
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "%s %s", slotName, info->subclassName.c_str()); ImGui::TextColored(ui::colors::kLightGray, "%s %s", slotName, info->subclassName.c_str());
else else
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "%s", slotName); ImGui::TextColored(ui::colors::kLightGray, "%s", slotName);
} }
} }
auto isWeaponInventoryType = [](uint32_t invType) { auto isWeaponInventoryType = [](uint32_t invType) {
@ -4472,7 +4472,7 @@ void GameScreen::renderTargetFrame(game::GameHandler& gameHandler) {
// Level color matches the hostility/difficulty color // Level color matches the hostility/difficulty color
ImVec4 levelColor = hostileColor; ImVec4 levelColor = hostileColor;
if (target->getType() == game::ObjectType::PLAYER) { if (target->getType() == game::ObjectType::PLAYER) {
levelColor = ImVec4(0.7f, 0.7f, 0.7f, 1.0f); levelColor = ui::colors::kLightGray;
} }
if (unit->getLevel() == 0) if (unit->getLevel() == 0)
ImGui::TextColored(levelColor, "Lv ??"); ImGui::TextColored(levelColor, "Lv ??");
@ -4895,7 +4895,7 @@ void GameScreen::renderTargetFrame(game::GameHandler& gameHandler) {
char durBuf[32]; char durBuf[32];
if (seconds < 60) snprintf(durBuf, sizeof(durBuf), "Remaining: %ds", seconds); if (seconds < 60) snprintf(durBuf, sizeof(durBuf), "Remaining: %ds", seconds);
else snprintf(durBuf, sizeof(durBuf), "Remaining: %dm %ds", seconds / 60, seconds % 60); else snprintf(durBuf, sizeof(durBuf), "Remaining: %dm %ds", seconds / 60, seconds % 60);
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "%s", durBuf); ImGui::TextColored(ui::colors::kLightGray, "%s", durBuf);
} }
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
@ -5127,7 +5127,7 @@ void GameScreen::renderTargetFrame(game::GameHandler& gameHandler) {
char db[32]; char db[32];
if (s < 60) snprintf(db, sizeof(db), "Remaining: %ds", s); if (s < 60) snprintf(db, sizeof(db), "Remaining: %ds", s);
else snprintf(db, sizeof(db), "Remaining: %dm %ds", s / 60, s % 60); else snprintf(db, sizeof(db), "Remaining: %dm %ds", s / 60, s % 60);
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "%s", db); ImGui::TextColored(ui::colors::kLightGray, "%s", db);
} }
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
@ -5598,7 +5598,7 @@ void GameScreen::renderFocusFrame(game::GameHandler& gameHandler) {
char db[32]; char db[32];
if (s < 60) snprintf(db, sizeof(db), "Remaining: %ds", s); if (s < 60) snprintf(db, sizeof(db), "Remaining: %ds", s);
else snprintf(db, sizeof(db), "Remaining: %dm %ds", s / 60, s % 60); else snprintf(db, sizeof(db), "Remaining: %dm %ds", s / 60, s % 60);
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "%s", db); ImGui::TextColored(ui::colors::kLightGray, "%s", db);
} }
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
@ -8373,7 +8373,7 @@ ImVec4 GameScreen::getChatTypeColor(game::ChatType type) const {
case game::ChatType::DND: case game::ChatType::DND:
return ImVec4(0.85f, 0.85f, 0.85f, 0.8f); // Light gray return ImVec4(0.85f, 0.85f, 0.85f, 0.8f); // Light gray
default: default:
return ImVec4(0.7f, 0.7f, 0.7f, 1.0f); // Gray return ui::colors::kLightGray; // Gray
} }
} }
@ -13568,7 +13568,7 @@ void GameScreen::renderBossFrames(game::GameHandler& gameHandler) {
char db[32]; char db[32];
if (s < 60) snprintf(db, sizeof(db), "Remaining: %ds", s); if (s < 60) snprintf(db, sizeof(db), "Remaining: %ds", s);
else snprintf(db, sizeof(db), "Remaining: %dm %ds", s / 60, s % 60); else snprintf(db, sizeof(db), "Remaining: %dm %ds", s / 60, s % 60);
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "%s", db); ImGui::TextColored(ui::colors::kLightGray, "%s", db);
} }
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
@ -15688,7 +15688,7 @@ void GameScreen::renderBuffBar(game::GameHandler& gameHandler) {
char durBuf[32]; char durBuf[32];
if (seconds < 60) snprintf(durBuf, sizeof(durBuf), "Remaining: %ds", seconds); if (seconds < 60) snprintf(durBuf, sizeof(durBuf), "Remaining: %ds", seconds);
else snprintf(durBuf, sizeof(durBuf), "Remaining: %dm %ds", seconds / 60, seconds % 60); else snprintf(durBuf, sizeof(durBuf), "Remaining: %dm %ds", seconds / 60, seconds % 60);
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "%s", durBuf); ImGui::TextColored(ui::colors::kLightGray, "%s", durBuf);
} }
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
@ -16253,7 +16253,7 @@ void GameScreen::renderQuestDetailsWindow(game::GameHandler& gameHandler) {
} }
if (quest.suggestedPlayers > 1) { if (quest.suggestedPlayers > 1) {
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), ImGui::TextColored(ui::colors::kLightGray,
"Suggested players: %u", quest.suggestedPlayers); "Suggested players: %u", quest.suggestedPlayers);
} }
@ -16696,7 +16696,7 @@ void GameScreen::renderVendorWindow(game::GameHandler& gameHandler) {
} }
ImGui::Separator(); ImGui::Separator();
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "Right-click bag items to sell"); ImGui::TextColored(ui::colors::kLightGray, "Right-click bag items to sell");
// Count grey (POOR quality) sellable items across backpack and bags // Count grey (POOR quality) sellable items across backpack and bags
const auto& inv = gameHandler.getInventory(); const auto& inv = gameHandler.getInventory();
@ -17163,7 +17163,7 @@ void GameScreen::renderTrainerWindow(game::GameHandler& gameHandler) {
} }
ImGui::TextDisabled("Status: %s", statusLabel); ImGui::TextDisabled("Status: %s", statusLabel);
if (spell->reqLevel > 0) { if (spell->reqLevel > 0) {
ImVec4 lvlColor = levelMet ? ImVec4(0.7f, 0.7f, 0.7f, 1.0f) : kColorRed; ImVec4 lvlColor = levelMet ? ui::colors::kLightGray : kColorRed;
ImGui::TextColored(lvlColor, "Required Level: %u", spell->reqLevel); ImGui::TextColored(lvlColor, "Required Level: %u", spell->reqLevel);
} }
if (spell->reqSkill > 0) ImGui::Text("Required Skill: %u (value %u)", spell->reqSkill, spell->reqSkillValue); if (spell->reqSkill > 0) ImGui::Text("Required Skill: %u (value %u)", spell->reqSkill, spell->reqSkillValue);
@ -17813,7 +17813,7 @@ void GameScreen::renderTaxiWindow(game::GameHandler& gameHandler) {
} }
if (destCount == 0) { if (destCount == 0) {
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "No destinations available."); ImGui::TextColored(ui::colors::kLightGray, "No destinations available.");
} }
ImGui::Spacing(); ImGui::Spacing();
@ -21792,7 +21792,7 @@ void GameScreen::renderMailComposeWindow(game::GameHandler& gameHandler) {
if (ImGui::IsItemHovered()) { if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImGui::TextColored(qualColor, "%s", att.item.name.c_str()); ImGui::TextColored(qualColor, "%s", att.item.name.c_str());
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "Click to remove"); ImGui::TextColored(ui::colors::kLightGray, "Click to remove");
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
} else { } else {
@ -24623,7 +24623,7 @@ void GameScreen::renderCombatLog(game::GameHandler& gameHandler) {
break; break;
default: default:
snprintf(desc, sizeof(desc), "Combat event (type %d, amount %d)", static_cast<int>(e.type), e.amount); snprintf(desc, sizeof(desc), "Combat event (type %d, amount %d)", static_cast<int>(e.type), e.amount);
color = ImVec4(0.7f, 0.7f, 0.7f, 1.0f); color = ui::colors::kLightGray;
break; break;
} }

View file

@ -1572,9 +1572,9 @@ void InventoryScreen::renderReputationPanel(game::GameHandler& gameHandler) {
ImGui::TextColored(tier.color, "[%s]", tier.name); ImGui::TextColored(tier.color, "[%s]", tier.name);
ImGui::SameLine(90.0f); ImGui::SameLine(90.0f);
if (atWar) { if (atWar) {
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), "%s", displayName); ImGui::TextColored(ui::colors::kRed, "%s", displayName);
ImGui::SameLine(); ImGui::SameLine();
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), "(At War)"); ImGui::TextColored(ui::colors::kRed, "(At War)");
} else if (isWatched) { } else if (isWatched) {
ImGui::TextColored(ImVec4(1.0f, 0.9f, 0.5f, 1.0f), "%s", displayName); ImGui::TextColored(ImVec4(1.0f, 0.9f, 0.5f, 1.0f), "%s", displayName);
ImGui::SameLine(); ImGui::SameLine();
@ -2265,7 +2265,7 @@ void InventoryScreen::renderItemSlot(game::Inventory& inventory, const game::Ite
if (label && ImGui::IsItemHovered()) { if (label && ImGui::IsItemHovered()) {
ImGui::BeginTooltip(); ImGui::BeginTooltip();
ImGui::TextColored(ImVec4(0.5f, 0.5f, 0.5f, 1.0f), "%s", label); ImGui::TextColored(ui::colors::kDarkGray, "%s", label);
ImGui::TextColored(ImVec4(0.4f, 0.4f, 0.4f, 1.0f), "Empty"); ImGui::TextColored(ImVec4(0.4f, 0.4f, 0.4f, 1.0f), "Empty");
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
@ -2589,7 +2589,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I
} }
ImGui::TextColored(ImVec4(0.8f, 0.9f, 1.0f, 1.0f), "Home: %s", homeLocation.c_str()); ImGui::TextColored(ImVec4(0.8f, 0.9f, 1.0f, 1.0f), "Home: %s", homeLocation.c_str());
} else { } else {
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "Home: not set"); ImGui::TextColored(ui::colors::kLightGray, "Home: not set");
} }
ImGui::TextDisabled("Use: Teleport home"); ImGui::TextDisabled("Use: Teleport home");
} }
@ -2627,9 +2627,9 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I
} }
if (slotName[0]) { if (slotName[0]) {
if (!item.subclassName.empty()) { if (!item.subclassName.empty()) {
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "%s %s", slotName, item.subclassName.c_str()); ImGui::TextColored(ui::colors::kLightGray, "%s %s", slotName, item.subclassName.c_str());
} else { } else {
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "%s", slotName); ImGui::TextColored(ui::colors::kLightGray, "%s", slotName);
} }
} }
@ -2671,7 +2671,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I
ImGui::Text("%.0f - %.0f Damage", item.damageMin, item.damageMax); ImGui::Text("%.0f - %.0f Damage", item.damageMin, item.damageMax);
ImGui::SameLine(160.0f); ImGui::SameLine(160.0f);
ImGui::TextDisabled("Speed %.2f", speed); ImGui::TextDisabled("Speed %.2f", speed);
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "(%.1f damage per second)", dps); ImGui::TextColored(ui::colors::kLightGray, "(%.1f damage per second)", dps);
} }
// Armor appears before stat bonuses — matches WoW tooltip order // Armor appears before stat bonuses — matches WoW tooltip order
@ -3104,8 +3104,8 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I
else else
std::snprintf(ilvlBuf, sizeof(ilvlBuf), "Item Level: %u (=)", item.itemLevel); std::snprintf(ilvlBuf, sizeof(ilvlBuf), "Item Level: %u (=)", item.itemLevel);
ImVec4 ilvlColor = (diff > 0.0f) ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f) ImVec4 ilvlColor = (diff > 0.0f) ? ImVec4(0.0f, 1.0f, 0.0f, 1.0f)
: (diff < 0.0f) ? ImVec4(1.0f, 0.3f, 0.3f, 1.0f) : (diff < 0.0f) ? ui::colors::kRed
: ImVec4(0.7f, 0.7f, 0.7f, 1.0f); : ui::colors::kLightGray;
ImGui::TextColored(ilvlColor, "%s", ilvlBuf); ImGui::TextColored(ilvlColor, "%s", ilvlBuf);
} }
@ -3119,10 +3119,10 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I
ImGui::TextColored(ImVec4(0.0f, 1.0f, 0.0f, 1.0f), "%s", buf); ImGui::TextColored(ImVec4(0.0f, 1.0f, 0.0f, 1.0f), "%s", buf);
} else if (diff < 0.0f) { } else if (diff < 0.0f) {
std::snprintf(buf, sizeof(buf), "%s: %.0f (▼%.0f)", label, newVal, -diff); std::snprintf(buf, sizeof(buf), "%s: %.0f (▼%.0f)", label, newVal, -diff);
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), "%s", buf); ImGui::TextColored(ui::colors::kRed, "%s", buf);
} else { } else {
std::snprintf(buf, sizeof(buf), "%s: %.0f (=)", label, newVal); std::snprintf(buf, sizeof(buf), "%s: %.0f (=)", label, newVal);
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "%s", buf); ImGui::TextColored(ui::colors::kLightGray, "%s", buf);
} }
}; };
@ -3299,9 +3299,9 @@ void InventoryScreen::renderItemTooltip(const game::ItemQueryResponseData& info,
} }
if (slotName[0]) { if (slotName[0]) {
if (!info.subclassName.empty()) if (!info.subclassName.empty())
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "%s %s", slotName, info.subclassName.c_str()); ImGui::TextColored(ui::colors::kLightGray, "%s %s", slotName, info.subclassName.c_str());
else else
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "%s", slotName); ImGui::TextColored(ui::colors::kLightGray, "%s", slotName);
} }
// Proficiency check for vendor/loot tooltips (ItemQueryResponseData has itemClass/subClass) // Proficiency check for vendor/loot tooltips (ItemQueryResponseData has itemClass/subClass)
@ -3327,7 +3327,7 @@ void InventoryScreen::renderItemTooltip(const game::ItemQueryResponseData& info,
ImGui::Text("%.0f - %.0f Damage", info.damageMin, info.damageMax); ImGui::Text("%.0f - %.0f Damage", info.damageMin, info.damageMax);
ImGui::SameLine(160.0f); ImGui::SameLine(160.0f);
ImGui::TextDisabled("Speed %.2f", speed); ImGui::TextDisabled("Speed %.2f", speed);
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "(%.1f damage per second)", dps); ImGui::TextColored(ui::colors::kLightGray, "(%.1f damage per second)", dps);
} }
if (info.armor > 0) ImGui::Text("%d Armor", info.armor); if (info.armor > 0) ImGui::Text("%d Armor", info.armor);

View file

@ -1,4 +1,5 @@
#include "ui/realm_screen.hpp" #include "ui/realm_screen.hpp"
#include "ui/ui_colors.hpp"
#include <imgui.h> #include <imgui.h>
namespace wowee { namespace ui { namespace wowee { namespace ui {
@ -32,7 +33,7 @@ void RealmScreen::render(auth::AuthHandler& authHandler) {
// Status message // Status message
if (!statusMessage.empty()) { if (!statusMessage.empty()) {
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.3f, 1.0f, 0.3f, 1.0f)); ImGui::PushStyleColor(ImGuiCol_Text, ui::colors::kBrightGreen);
ImGui::TextWrapped("%s", statusMessage.c_str()); ImGui::TextWrapped("%s", statusMessage.c_str());
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::Spacing(); ImGui::Spacing();
@ -153,9 +154,9 @@ void RealmScreen::render(auth::AuthHandler& authHandler) {
ImGui::TableSetColumnIndex(4); ImGui::TableSetColumnIndex(4);
const char* status = getRealmStatus(realm.flags); const char* status = getRealmStatus(realm.flags);
if (realm.lock) { if (realm.lock) {
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), "Locked"); ImGui::TextColored(ui::colors::kRed, "Locked");
} else { } else {
ImGui::TextColored(ImVec4(0.3f, 1.0f, 0.3f, 1.0f), "%s", status); ImGui::TextColored(ui::colors::kBrightGreen, "%s", status);
} }
} }
@ -202,7 +203,7 @@ void RealmScreen::render(auth::AuthHandler& authHandler) {
} }
ImGui::PopStyleColor(2); ImGui::PopStyleColor(2);
} else { } else {
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.5f, 0.5f, 0.5f, 1.0f)); ImGui::PushStyleColor(ImGuiCol_Button, ui::colors::kDarkGray);
ImGui::Button("Realm Locked", ImVec2(200, 40)); ImGui::Button("Realm Locked", ImVec2(200, 40));
ImGui::PopStyleColor(); ImGui::PopStyleColor();
} }
@ -237,13 +238,13 @@ const char* RealmScreen::getRealmStatus(uint8_t flags) const {
ImVec4 RealmScreen::getPopulationColor(float population) const { ImVec4 RealmScreen::getPopulationColor(float population) const {
if (population < 0.5f) { if (population < 0.5f) {
return ImVec4(0.3f, 1.0f, 0.3f, 1.0f); // Green - Low return ui::colors::kBrightGreen; // Green - Low
} else if (population < 1.5f) { } else if (population < 1.5f) {
return ImVec4(1.0f, 1.0f, 0.3f, 1.0f); // Yellow - Medium return ImVec4(1.0f, 1.0f, 0.3f, 1.0f); // Yellow - Medium
} else if (population < 2.5f) { } else if (population < 2.5f) {
return ImVec4(1.0f, 0.6f, 0.0f, 1.0f); // Orange - High return ImVec4(1.0f, 0.6f, 0.0f, 1.0f); // Orange - High
} else { } else {
return ImVec4(1.0f, 0.3f, 0.3f, 1.0f); // Red - Full return ui::colors::kRed; // Red - Full
} }
} }

View file

@ -1,4 +1,5 @@
#include "ui/spellbook_screen.hpp" #include "ui/spellbook_screen.hpp"
#include "ui/ui_colors.hpp"
#include "ui/keybinding_manager.hpp" #include "ui/keybinding_manager.hpp"
#include "core/input.hpp" #include "core/input.hpp"
#include "core/application.hpp" #include "core/application.hpp"
@ -585,7 +586,7 @@ void SpellbookScreen::renderSpellTooltip(const SpellInfo* info, game::GameHandle
// Cooldown if active // Cooldown if active
float cd = gameHandler.getSpellCooldown(info->spellId); float cd = gameHandler.getSpellCooldown(info->spellId);
if (cd > 0.0f) { if (cd > 0.0f) {
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), "Cooldown: %.1fs", cd); ImGui::TextColored(ui::colors::kRed, "Cooldown: %.1fs", cd);
} }
// Description // Description
@ -597,8 +598,8 @@ void SpellbookScreen::renderSpellTooltip(const SpellInfo* info, game::GameHandle
// Usage hints — only shown when browsing the spellbook, not on action bar hover // Usage hints — only shown when browsing the spellbook, not on action bar hover
if (!info->isPassive() && showUsageHints) { if (!info->isPassive() && showUsageHints) {
ImGui::Spacing(); ImGui::Spacing();
ImGui::TextColored(ImVec4(0.3f, 1.0f, 0.3f, 1.0f), "Drag to action bar"); ImGui::TextColored(ui::colors::kBrightGreen, "Drag to action bar");
ImGui::TextColored(ImVec4(0.3f, 1.0f, 0.3f, 1.0f), "Double-click to cast"); ImGui::TextColored(ui::colors::kBrightGreen, "Double-click to cast");
} }
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();

View file

@ -1,4 +1,5 @@
#include "ui/talent_screen.hpp" #include "ui/talent_screen.hpp"
#include "ui/ui_colors.hpp"
#include "ui/keybinding_manager.hpp" #include "ui/keybinding_manager.hpp"
#include "core/input.hpp" #include "core/input.hpp"
#include "core/application.hpp" #include "core/application.hpp"
@ -141,10 +142,10 @@ void TalentScreen::renderTalentTrees(game::GameHandler& gameHandler) {
// Unspent points // Unspent points
ImGui::SameLine(0, 20); ImGui::SameLine(0, 20);
if (unspent > 0) { if (unspent > 0) {
ImGui::TextColored(ImVec4(0.3f, 1.0f, 0.3f, 1.0f), "%u point%s available", ImGui::TextColored(ui::colors::kBrightGreen, "%u point%s available",
unspent, unspent > 1 ? "s" : ""); unspent, unspent > 1 ? "s" : "");
} else { } else {
ImGui::TextColored(ImVec4(0.5f, 0.5f, 0.5f, 1.0f), "No points available"); ImGui::TextColored(ui::colors::kDarkGray, "No points available");
} }
ImGui::Separator(); ImGui::Separator();
@ -552,7 +553,7 @@ void TalentScreen::renderTalent(game::GameHandler& gameHandler,
auto tooltipIt = spellTooltips.find(talent.rankSpells[currentRank]); auto tooltipIt = spellTooltips.find(talent.rankSpells[currentRank]);
if (tooltipIt != spellTooltips.end() && !tooltipIt->second.empty()) { if (tooltipIt != spellTooltips.end() && !tooltipIt->second.empty()) {
ImGui::Spacing(); ImGui::Spacing();
ImGui::TextColored(ImVec4(0.3f, 1.0f, 0.3f, 1.0f), "Next Rank:"); ImGui::TextColored(ui::colors::kBrightGreen, "Next Rank:");
ImGui::TextWrapped("%s", tooltipIt->second.c_str()); ImGui::TextWrapped("%s", tooltipIt->second.c_str());
} }
} }
@ -581,7 +582,7 @@ void TalentScreen::renderTalent(game::GameHandler& gameHandler,
uint32_t requiredPoints = talent.row * 5; uint32_t requiredPoints = talent.row * 5;
if (pointsInTree < requiredPoints) { if (pointsInTree < requiredPoints) {
ImGui::Spacing(); ImGui::Spacing();
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), ImGui::TextColored(ui::colors::kRed,
"Requires %u points in this tree (%u/%u)", "Requires %u points in this tree (%u/%u)",
requiredPoints, pointsInTree, requiredPoints); requiredPoints, pointsInTree, requiredPoints);
} }
@ -590,7 +591,7 @@ void TalentScreen::renderTalent(game::GameHandler& gameHandler,
// Action hint // Action hint
if (canLearn && prereqsMet) { if (canLearn && prereqsMet) {
ImGui::Spacing(); ImGui::Spacing();
ImGui::TextColored(ImVec4(0.3f, 1.0f, 0.3f, 1.0f), "Click to learn"); ImGui::TextColored(ui::colors::kBrightGreen, "Click to learn");
} }
ImGui::PopTextWrapPos(); ImGui::PopTextWrapPos();
@ -748,7 +749,7 @@ void TalentScreen::renderGlyphs(game::GameHandler& gameHandler) {
if (!name.empty()) { if (!name.empty()) {
ImGui::TextColored(ImVec4(0.9f, 0.9f, 0.9f, 1.0f), "%s", name.c_str()); ImGui::TextColored(ImVec4(0.9f, 0.9f, 0.9f, 1.0f), "%s", name.c_str());
} else { } else {
ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "Glyph #%u", static_cast<uint32_t>(glyphId)); ImGui::TextColored(ui::colors::kLightGray, "Glyph #%u", static_cast<uint32_t>(glyphId));
} }
}; };