MP Lobby: used specific colors instead of pango presets
The Pango presets are usually a little darker than we want, so this makes the colors POP.
(cherry-picked from commit 3d158130f4
)
This commit is contained in:
parent
2445e295e5
commit
ce79934810
1 changed files with 8 additions and 11 deletions
|
@ -42,6 +42,7 @@
|
|||
|
||||
#include "addon/manager_ui.hpp"
|
||||
#include "chat_log.hpp"
|
||||
#include "font/text_formatting.hpp"
|
||||
#include "formatter.hpp"
|
||||
#include "formula/string_utils.hpp"
|
||||
#include "preferences/game.hpp"
|
||||
|
@ -210,13 +211,9 @@ void modify_grid_with_data(grid* grid, const std::map<std::string, string_map>&
|
|||
}
|
||||
}
|
||||
|
||||
std::string colorize(const std::string& str, const std::string& color)
|
||||
std::string colorize(const std::string& str, const color_t& color)
|
||||
{
|
||||
if(color.empty()) {
|
||||
return str;
|
||||
}
|
||||
|
||||
return (formatter() << "<span color=\"" << color << "\">" << str << "</span>").str();
|
||||
return (formatter() << font::span_color(color) << str << "</span>").str();
|
||||
}
|
||||
|
||||
bool handle_addon_requirements_gui(const std::vector<mp::game_info::required_addon>& reqs, mp::game_info::ADDON_REQ addon_outcome)
|
||||
|
@ -421,15 +418,15 @@ std::map<std::string, string_map> mp_lobby::make_game_row_data(const mp::game_in
|
|||
|
||||
item["use_markup"] = "true";
|
||||
|
||||
std::string color_string;
|
||||
color_t color_string;
|
||||
if(game.vacant_slots > 0) {
|
||||
color_string = (game.reloaded || game.started) ? "yellow" : "green";
|
||||
color_string = (game.reloaded || game.started) ? font::YELLOW_COLOR : font::GOOD_COLOR;
|
||||
}
|
||||
|
||||
item["label"] = game.name;
|
||||
data.emplace("name", item);
|
||||
|
||||
item["label"] = colorize("<i>" + game.scenario + "</i>", font::GRAY_COLOR.to_hex_string());
|
||||
item["label"] = colorize("<i>" + game.scenario + "</i>", font::GRAY_COLOR);
|
||||
data.emplace("scenario", item);
|
||||
|
||||
item["label"] = colorize(game.status, color_string);
|
||||
|
@ -601,12 +598,12 @@ void mp_lobby::update_playerlist()
|
|||
target_list = &player_list_.other_rooms;
|
||||
break;
|
||||
case mp::user_info::SEL_GAME:
|
||||
name = colorize(name, "cyan");
|
||||
name = colorize(name, {0, 255, 255});
|
||||
icon_ss << (user.observing ? "-obs" : "-playing");
|
||||
target_list = &player_list_.active_game;
|
||||
break;
|
||||
case mp::user_info::GAME:
|
||||
name = colorize(name, "red");
|
||||
name = colorize(name, font::BAD_COLOR);
|
||||
icon_ss << (user.observing ? "-obs" : "-playing");
|
||||
target_list = &player_list_.other_games;
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue