fixed issue with color in console_output::get_code
This commit is contained in:
@ -41,29 +41,20 @@ std::string console_output::get_code(const int attr) {
|
|||||||
if (attr & A_UNDERLINE)
|
if (attr & A_UNDERLINE)
|
||||||
result += "4;";
|
result += "4;";
|
||||||
|
|
||||||
if (attr & COLOR_PAIR(COLOR_BLACK))
|
if ((attr & COLOR_PAIR(COLOR_WHITE)) == COLOR_PAIR(COLOR_WHITE))
|
||||||
result += "30;";
|
|
||||||
|
|
||||||
if (attr & COLOR_PAIR(COLOR_RED))
|
|
||||||
result += "31;";
|
|
||||||
|
|
||||||
if (attr & COLOR_PAIR(COLOR_GREEN))
|
|
||||||
result += "32;";
|
|
||||||
|
|
||||||
if (attr & COLOR_PAIR(COLOR_YELLOW))
|
|
||||||
result += "33;";
|
|
||||||
|
|
||||||
if (attr & COLOR_PAIR(COLOR_BLUE))
|
|
||||||
result += "34;";
|
|
||||||
|
|
||||||
if (attr & COLOR_PAIR(COLOR_MAGENTA))
|
|
||||||
result += "35;";
|
|
||||||
|
|
||||||
if (attr & COLOR_PAIR(COLOR_CYAN))
|
|
||||||
result += "36;";
|
|
||||||
|
|
||||||
if (attr & COLOR_PAIR(COLOR_WHITE))
|
|
||||||
result += "37;";
|
result += "37;";
|
||||||
|
else if ((attr & COLOR_PAIR(COLOR_CYAN)) == COLOR_PAIR(COLOR_CYAN))
|
||||||
|
result += "36;";
|
||||||
|
else if ((attr & COLOR_PAIR(COLOR_MAGENTA)) == COLOR_PAIR(COLOR_MAGENTA))
|
||||||
|
result += "35;";
|
||||||
|
else if ((attr & COLOR_PAIR(COLOR_BLUE)) == COLOR_PAIR(COLOR_BLUE))
|
||||||
|
result += "34;";
|
||||||
|
else if ((attr & COLOR_PAIR(COLOR_YELLOW)) == COLOR_PAIR(COLOR_YELLOW))
|
||||||
|
result += "33;";
|
||||||
|
else if ((attr & COLOR_PAIR(COLOR_RED)) == COLOR_PAIR(COLOR_RED))
|
||||||
|
result += "31;";
|
||||||
|
else if ((attr & COLOR_PAIR(COLOR_GREEN)) == COLOR_PAIR(COLOR_GREEN))
|
||||||
|
result += "32;";
|
||||||
|
|
||||||
result[result.length() - 1] = 'm';
|
result[result.length() - 1] = 'm';
|
||||||
return result;
|
return result;
|
||||||
|
Reference in New Issue
Block a user