mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Color: Remove redundant flag in colorize method
This commit is contained in:
parent
24bb1fd6ca
commit
7bea132bd5
1 changed files with 1 additions and 17 deletions
|
@ -447,35 +447,19 @@ std::string Color::colorize (const std::string& input)
|
||||||
// 256 color
|
// 256 color
|
||||||
if (_value & _COLOR_256)
|
if (_value & _COLOR_256)
|
||||||
{
|
{
|
||||||
bool needTerminator = false;
|
|
||||||
|
|
||||||
if (_value & _COLOR_UNDERLINE)
|
if (_value & _COLOR_UNDERLINE)
|
||||||
{
|
|
||||||
result << "\033[4m";
|
result << "\033[4m";
|
||||||
needTerminator = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_value & _COLOR_INVERSE)
|
if (_value & _COLOR_INVERSE)
|
||||||
{
|
|
||||||
result << "\033[7m";
|
result << "\033[7m";
|
||||||
needTerminator = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_value & _COLOR_HASFG)
|
if (_value & _COLOR_HASFG)
|
||||||
{
|
|
||||||
result << "\033[38;5;" << (_value & _COLOR_FG) << "m";
|
result << "\033[38;5;" << (_value & _COLOR_FG) << "m";
|
||||||
needTerminator = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_value & _COLOR_HASBG)
|
if (_value & _COLOR_HASBG)
|
||||||
{
|
|
||||||
result << "\033[48;5;" << ((_value & _COLOR_BG) >> 8) << "m";
|
result << "\033[48;5;" << ((_value & _COLOR_BG) >> 8) << "m";
|
||||||
needTerminator = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
result << input;
|
result << input << "\033[0m";
|
||||||
if (needTerminator)
|
|
||||||
result << "\033[0m";
|
|
||||||
|
|
||||||
return result.str ();
|
return result.str ();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue