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;
|
next_arg_index_ = 0;
|
||||||
const Char *s = start;
|
const Char *s = start;
|
||||||
BasicWriter<Char> &writer = *writer_;
|
BasicWriter<Char> &writer = *writer_;
|
||||||
|
|
||||||
|
// fmt::colour(fmt::Red);
|
||||||
|
|
||||||
while (*s) {
|
while (*s) {
|
||||||
Char c = *s++;
|
Char c = *s++;
|
||||||
if (c != '{' && c != '}') continue;
|
if (c != '{' && c != '}') continue;
|
||||||
@ -727,3 +730,11 @@ template void fmt::BasicFormatter<wchar_t>::CheckSign(
|
|||||||
const wchar_t *&s, const Arg &arg);
|
const wchar_t *&s, const Arg &arg);
|
||||||
|
|
||||||
template void fmt::BasicFormatter<wchar_t>::DoFormat();
|
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.
|
the output is sent to a :cpp:class:`fmt::Writer` object.
|
||||||
\endrst
|
\endrst
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
enum Colours{black=30,red,green,yellow,blue,Magenta,cyan,white};
|
||||||
|
|
||||||
|
void colour(Colours);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename Char>
|
template <typename Char>
|
||||||
class BasicFormatter {
|
class BasicFormatter {
|
||||||
private:
|
private:
|
||||||
@ -1359,8 +1367,12 @@ class Write {
|
|||||||
inline Formatter<Write> Print(StringRef format) {
|
inline Formatter<Write> Print(StringRef format) {
|
||||||
Formatter<Write> f(format);
|
Formatter<Write> f(format);
|
||||||
return f;
|
return f;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
}//end namespace internal (?)
|
||||||
|
}//end namespace format (?)
|
||||||
|
|
||||||
#ifdef FMT_GCC_DIAGNOSTIC
|
#ifdef FMT_GCC_DIAGNOSTIC
|
||||||
# pragma GCC diagnostic pop
|
# pragma GCC diagnostic pop
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user