mirror of
https://github.com/QtExcel/QXlsx.git
synced 2025-01-30 05:02:52 +08:00
append pump tester, using libxlsxwriter data.
This commit is contained in:
parent
331c57f4cb
commit
a380bcecf1
35
Pump/text_coloring.h
Normal file
35
Pump/text_coloring.h
Normal file
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
|
||||
namespace coloring {
|
||||
|
||||
enum class Color {
|
||||
BLACK = 0,
|
||||
RED = 1,
|
||||
GREEN = 2,
|
||||
YELLOW = 3,
|
||||
BLUE = 4,
|
||||
MAGENTA = 5,
|
||||
CYAN = 6,
|
||||
WHITE = 7,
|
||||
DEFAULT = 9
|
||||
};
|
||||
|
||||
namespace {
|
||||
char textcolor[] = {0x1b, '[', '1', ';', '3'};
|
||||
std::string getColorCode(Color c) {
|
||||
std::stringstream ss;
|
||||
ss << textcolor << static_cast<int>(c) << "m";
|
||||
return ss.str();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
||||
std::string coloringText(std::string str, Color c) {
|
||||
std::stringstream ss;
|
||||
ss << getColorCode(c) << str << getColorCode(Color::DEFAULT);
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user