Skip to content
Snippets Groups Projects
Commit 06d53870 authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler
Browse files

[commo.color] moved colorString() and colorStringRed() to lib

parent 3e1d4bde
No related branches found
No related tags found
No related merge requests found
...@@ -98,6 +98,17 @@ std::string highlightSearchString(std::string str, std::string substr, int color ...@@ -98,6 +98,17 @@ std::string highlightSearchString(std::string str, std::string substr, int color
return str; return str;
} // highlightSearchString } // highlightSearchString
std::string colorString(const std::string _string, const std::string _color /*= Colors::brown*/)
{
return _color + _string + "\033[0m";
}
std::string colorStringRed(const std::string _string)
{
return colorString(_string, Colors::red);
}
} // namespace Common } // namespace Common
} // namespace Stuff } // namespace Stuff
} // namespace Dune } // namespace Dune
...@@ -132,15 +132,9 @@ inline std::string highlightString(std::string str, int colornr = 0) ...@@ -132,15 +132,9 @@ inline std::string highlightString(std::string str, int colornr = 0)
return "\033[38;5;" + toString(colornr % 256) + "m" + str + "\033[0m"; //"\033[38;5;0m"; return "\033[38;5;" + toString(colornr % 256) + "m" + str + "\033[0m"; //"\033[38;5;0m";
} }
inline std::string colorString(const std::string _string, const std::string _color = Colors::brown) std::string colorString(const std::string _string, const std::string _color = Colors::brown);
{
return _color + _string + "\033[0m";
}
inline std::string colorStringRed(const std::string _string) std::string colorStringRed(const std::string _string);
{
return colorString(_string, Colors::red);
}
/** /**
* @brief Highlights a substring of another string in a specified color. * @brief Highlights a substring of another string in a specified color.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment