add normaltxt, yellowify->yellowtxt

This commit is contained in:
Ben Burdette 2020-05-04 16:19:20 -06:00
parent 8c8f2b74ec
commit f30de61578

View file

@ -73,18 +73,31 @@ inline std::string fmt(const std::string & fs, const Args & ... args)
// are always in yellow. // are always in yellow.
template <class T> template <class T>
struct yellowify struct yellowtxt
{ {
yellowify(T &s) : value(s) {} yellowtxt(T &s) : value(s) {}
T &value; T &value;
}; };
template <class T> template <class T>
std::ostream& operator<<(std::ostream &out, const yellowify<T> &y) std::ostream& operator<<(std::ostream &out, const yellowtxt<T> &y)
{ {
return out << ANSI_YELLOW << y.value << ANSI_NORMAL; return out << ANSI_YELLOW << y.value << ANSI_NORMAL;
} }
template <class T>
struct normaltxt
{
normaltxt(T &s) : value(s) {}
T &value;
};
template <class T>
std::ostream& operator<<(std::ostream &out, const normaltxt<T> &y)
{
return out << ANSI_NORMAL << y.value;
}
class hintformat class hintformat
{ {
public: public:
@ -100,7 +113,7 @@ public:
template<class T> template<class T>
hintformat& operator%(const T &value) hintformat& operator%(const T &value)
{ {
fmt % yellowify(value); fmt % yellowtxt(value);
return *this; return *this;
} }