add colours e.g. fmt::colour(fmt::red)
This commit is contained in:
parent
affa794794
commit
360e0f7602
11
format.cc
11
format.cc
@ -423,6 +423,9 @@ void fmt::BasicFormatter<Char>::DoFormat() {
|
||||
next_arg_index_ = 0;
|
||||
const Char *s = start;
|
||||
BasicWriter<Char> &writer = *writer_;
|
||||
|
||||
// fmt::colour(fmt::Red);
|
||||
|
||||
while (*s) {
|
||||
Char c = *s++;
|
||||
if (c != '{' && c != '}') continue;
|
||||
@ -727,3 +730,11 @@ template void fmt::BasicFormatter<wchar_t>::CheckSign(
|
||||
const wchar_t *&s, const Arg &arg);
|
||||
|
||||
template void fmt::BasicFormatter<wchar_t>::DoFormat();
|
||||
|
||||
|
||||
|
||||
|
||||
void fmt::colour(Colours col)
|
||||
{
|
||||
printf("\033[0;%dm",col);
|
||||
}
|
||||
|
||||
16
format.h
16
format.h
@ -910,6 +910,14 @@ void FormatCustomArg(
|
||||
the output is sent to a :cpp:class:`fmt::Writer` object.
|
||||
\endrst
|
||||
*/
|
||||
|
||||
|
||||
enum Colours{black=30,red,green,yellow,blue,Magenta,cyan,white};
|
||||
|
||||
void colour(Colours);
|
||||
|
||||
|
||||
|
||||
template <typename Char>
|
||||
class BasicFormatter {
|
||||
private:
|
||||
@ -1359,8 +1367,12 @@ class Write {
|
||||
inline Formatter<Write> Print(StringRef format) {
|
||||
Formatter<Write> f(format);
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}//end namespace internal (?)
|
||||
}//end namespace format (?)
|
||||
|
||||
#ifdef FMT_GCC_DIAGNOSTIC
|
||||
# pragma GCC diagnostic pop
|
||||
|
||||
Loading…
Reference in New Issue
Block a user