nice disable of servers
This commit is contained in:
@@ -40,7 +40,8 @@ const std::map<std::string, coloredText> kReplacements = {
|
||||
{":error:", {"!", kTextColor_Red}},
|
||||
{":question:", {"?", kTextColor_DarkGrey}},
|
||||
{":greytick:", {"+", kTextColor_LightGrey}},
|
||||
{":greycross:", {"x", kTextColor_LightGrey}}
|
||||
{":greycross:", {"x", kTextColor_LightGrey}},
|
||||
{":disabled:", {"", kTextColor_DarkGrey}} // Special marker for disabled rows
|
||||
};
|
||||
|
||||
// Helper function to get ANSI color code
|
||||
@@ -285,11 +286,26 @@ void tableprint::print() {
|
||||
// Print rows
|
||||
for (size_t row_idx = 1; row_idx < rows.size(); ++row_idx) {
|
||||
const auto& row = rows[row_idx];
|
||||
|
||||
// Check if this row contains :disabled: marker
|
||||
bool is_disabled = false;
|
||||
for (const auto& cell : row) {
|
||||
if (cell.find(":disabled:") != std::string::npos) {
|
||||
is_disabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
dropshell::info << "\033[90m"; // Dark grey color for borders
|
||||
dropshell::info << "|";
|
||||
for (size_t i = 0; i < row.size(); ++i) {
|
||||
// Set the appropriate color for the row
|
||||
std::string rowcolor = (row_idx % 2 == 1) ? "\033[38;5;142m" : "\033[38;5;250m";
|
||||
std::string rowcolor;
|
||||
if (is_disabled) {
|
||||
rowcolor = "\033[90m"; // Dark grey for disabled servers
|
||||
} else {
|
||||
rowcolor = (row_idx % 2 == 1) ? "\033[38;5;142m" : "\033[38;5;250m";
|
||||
}
|
||||
dropshell::info << width_print_left(row[i],col_widths[i]+2,rowcolor);
|
||||
dropshell::info << "\033[90m" << "|";
|
||||
}
|
||||
|
Reference in New Issue
Block a user